diff options
-rw-r--r-- | URPM.xs | 36 |
1 files changed, 18 insertions, 18 deletions
@@ -207,25 +207,25 @@ get_name(Header header, rpmTag tag) { HE_t val = (HE_t)memset(alloca(sizeof(*val)), 0, sizeof(*val)); val->tag = tag; - headerGet(header, val, 0); - - if (val->t == RPM_STRING_TYPE) - return val->p.str; - else if(val->t == RPM_STRING_ARRAY_TYPE || val->t == RPM_I18NSTRING_TYPE) - return val->p.argv[val->ix]; + if(headerGet(header, val, 0)) { + if (val->t == RPM_STRING_TYPE) + return val->p.str; + else if(val->t == RPM_STRING_ARRAY_TYPE || val->t == RPM_I18NSTRING_TYPE) + return val->p.argv[val->ix]; + } return ""; } static int get_int(Header header, rpmTag tag) { HE_t val = (HE_t)memset(alloca(sizeof(*val)), 0, sizeof(*val)); - int ret; + int ret = 0; val->tag = tag; - headerGet(header, val, 0); - - ret = (val->t == RPM_UINT32_TYPE) ? val->p.ui32p[val->ix >= 0 ? val->ix : 0] : 0; - val->p.ui32p = _free(val->p.ui32p); + if(headerGet(header, val, 0)) { + ret = (val->t == RPM_UINT32_TYPE) ? val->p.ui32p[val->ix >= 0 ? val->ix : 0] : 0; + val->p.ui32p = _free(val->p.ui32p); + } return ret; } @@ -1682,12 +1682,14 @@ Pkg_is_platform_compat(pkg) CODE: read_config_files(0); + RETVAL = 0; if (pkg->h && headerIsEntry(pkg->h, RPMTAG_PLATFORM)) { val->tag = RPMTAG_PLATFORM; - (void) headerGet(pkg->h, val, 0); - platform = val->p.str; - RETVAL = rpmPlatformScore(platform, NULL, 0); - platform = _free(platform); + if(headerGet(pkg->h, val, 0)) { + platform = val->p.str; + RETVAL = rpmPlatformScore(platform, NULL, 0); + platform = _free(platform); + } } else if (pkg->info) { char *arch; char *eos; @@ -1697,9 +1699,7 @@ Pkg_is_platform_compat(pkg) RETVAL = rpmPlatformScore(platform, NULL, 0); restore_chars(); _free(platform); - } else { - RETVAL = 0; - } + } OUTPUT: RETVAL |