diff options
author | Per Øyvind Karlsen <peroyvind@mandriva.org> | 2010-11-17 22:57:52 +0000 |
---|---|---|
committer | Per Øyvind Karlsen <peroyvind@mandriva.org> | 2010-11-17 22:57:52 +0000 |
commit | 249014779de9718f839a7dc1d60bc8a775e541fc (patch) | |
tree | b5c98287e8f8acf57b62e000aa7245edcd9d8d22 | |
parent | 1a85d5e16dc59ca42a5669a517685f9d1839f965 (diff) | |
download | perl-URPM-249014779de9718f839a7dc1d60bc8a775e541fc.tar perl-URPM-249014779de9718f839a7dc1d60bc8a775e541fc.tar.gz perl-URPM-249014779de9718f839a7dc1d60bc8a775e541fc.tar.bz2 perl-URPM-249014779de9718f839a7dc1d60bc8a775e541fc.tar.xz perl-URPM-249014779de9718f839a7dc1d60bc8a775e541fc.zip |
check return value of remaining headerGet() usage
-rw-r--r-- | URPM.xs | 33 |
1 files changed, 20 insertions, 13 deletions
@@ -769,29 +769,36 @@ return_files(Header header, int filter_mode) { HE_t he_fmodes = memset(alloca(sizeof(*he_fmodes)), 0, sizeof(*he_fmodes)); he_flags->tag = RPMTAG_FILEFLAGS; + if(headerGet(header, he_flags, 0)) + flags = (rpmsenseFlags*)he_flags->p.ui32p; + he_fmodes->tag = RPMTAG_FILEMODES; - headerGet(header, he_flags, 0); - headerGet(header, he_fmodes, 0); - flags = (rpmsenseFlags*)he_flags->p.ui32p; - fmodes = he_fmodes->p.ui16p; + if(headerGet(header, he_fmodes, 0)) + fmodes = he_fmodes->p.ui16p; } + const char **baseNames = NULL; + const char **dirNames = NULL; + uint32_t *dirIndexes = NULL; + const char **list = NULL; + HE_t he_baseNames = memset(alloca(sizeof(*he_baseNames)), 0, sizeof(*he_baseNames)); HE_t he_dirIndexes = memset(alloca(sizeof(*he_dirIndexes)), 0, sizeof(*he_dirIndexes)); HE_t he_dirNames = memset(alloca(sizeof(*he_dirNames)), 0, sizeof(*he_dirNames)); he_baseNames->tag = RPMTAG_BASENAMES; + if(headerGet(header, he_baseNames, 0)) + baseNames = he_baseNames->p.argv; + he_dirIndexes->tag = RPMTAG_DIRINDEXES; + if(headerGet(header, he_dirIndexes, 0)) + dirNames = he_dirNames->p.argv; + he_dirNames->tag = RPMTAG_DIRNAMES; - headerGet(header, he_baseNames, 0); - headerGet(header, he_dirIndexes, 0); - headerGet(header, he_dirNames, 0); + if(headerGet(header, he_dirNames, 0)) + dirIndexes = he_dirIndexes->p.ui32p; - const char **baseNames = he_baseNames->p.argv; - const char **dirNames = he_dirNames->p.argv; - uint32_t *dirIndexes = he_dirIndexes->p.ui32p; - const char **list = NULL; if (!baseNames || !dirNames || !dirIndexes) { HE_t he_list = memset(alloca(sizeof(*he_list)), 0, sizeof(*he_list)); @@ -1145,8 +1152,8 @@ update_provides_files(URPM__Package pkg, HV *provides) { HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he)); he->tag = RPMTAG_OLDFILENAMES; - headerGet(pkg->h, he, 0); - if (list) { + if(headerGet(pkg->h, he, 0)) { + list = he->p.argv; for (he->ix = 0; he->ix < (int)he->c; he->ix++) { len = strlen(list[he->ix]); |