diff options
author | jbj <devnull@localhost> | 2001-02-04 22:15:30 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2001-02-04 22:15:30 +0000 |
commit | 1b9cbfcc5e6b6971acf99b8d65e84fb6764c2de3 (patch) | |
tree | e2dd0de7b5e02112f2d2c237e6c5a29891fab2d9 /lib | |
parent | a0a2c1d83cc45c575f53989cb72d5bd2aed40014 (diff) | |
download | rpm-1b9cbfcc5e6b6971acf99b8d65e84fb6764c2de3.tar.gz rpm-1b9cbfcc5e6b6971acf99b8d65e84fb6764c2de3.tar.bz2 rpm-1b9cbfcc5e6b6971acf99b8d65e84fb6764c2de3.zip |
revert speedup on commit if same perms, there's more to do.
lclint annotations.
CVS patchset: 4520
CVS date: 2001/02/04 22:15:30
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cpio.c | 162 | ||||
-rw-r--r-- | lib/depends.c | 201 | ||||
-rw-r--r-- | lib/install.c | 6 | ||||
-rw-r--r-- | lib/rollback.c | 5 | ||||
-rw-r--r-- | lib/rollback.h | 37 | ||||
-rw-r--r-- | lib/rpmlib.h | 16 | ||||
-rw-r--r-- | lib/transaction.c | 32 |
7 files changed, 234 insertions, 225 deletions
diff --git a/lib/cpio.c b/lib/cpio.c index 592f05456..5a0c020da 100644 --- a/lib/cpio.c +++ b/lib/cpio.c @@ -14,10 +14,10 @@ #include "rpmerr.h" #include "debug.h" -/*@access FD_t@*/ -/*@access rpmTransactionSet@*/ -/*@access TFI_t@*/ -/*@access FSM_t@*/ +/*@access FD_t @*/ +/*@access rpmTransactionSet @*/ +/*@access TFI_t @*/ +/*@access FSM_t @*/ #define CPIO_NEWC_MAGIC "070701" #define CPIO_CRC_MAGIC "070702" @@ -30,13 +30,13 @@ static /*@null@*/ void * _free(/*@only@*/ /*@null@*/ const void * this) { return NULL; } -int _fsm_debug = 1; +int _fsm_debug = 0; /** \ingroup payload * Keeps track of the set of all hard links to a file in an archive. */ struct hardLink { -/*@dependent@*/ struct hardLink * next; +/*@owned@*/ struct hardLink * next; /*@owned@*/ const char ** files; /* nlink of these, used by install */ /*@owned@*/ const char ** nsuffix; /*@owned@*/ int * filex; @@ -51,8 +51,8 @@ struct hardLink { /** */ typedef struct fsmIterator_s { -/*@dependent@*/ rpmTransactionSet ts; /*!< transaction set. */ -/*@dependent@*/ TFI_t fi; /*!< transaction element file info. */ +/*@kept@*/ rpmTransactionSet ts; /*!< transaction set. */ +/*@kept@*/ TFI_t fi; /*!< transaction element file info. */ int isave; /*!< last returned iterator index. */ int i; /*!< iterator index. */ } * FSMI_t; @@ -65,30 +65,30 @@ struct fsm_s { /*@owned@*/ const char * opath; /*!< Original file name. */ FD_t cfd; /*!< Payload file handle. */ FD_t rfd; /*!< read: File handle. */ -/*@owned@*/ char * rdbuf; /*!< read: Buffer. */ -/*@dependent@*/ char * rdb; /*!< read: Buffer allocated. */ +/*@dependent@*/ char * rdbuf; /*!< read: Buffer. */ +/*@owned@*/ char * rdb; /*!< read: Buffer allocated. */ size_t rdsize; /*!< read: Buffer allocated size. */ size_t rdlen; /*!< read: Number of bytes requested. */ size_t rdnb; /*!< read: Number of bytes returned. */ FD_t wfd; /*!< write: File handle. */ -/*@owned@*/ char * wrbuf; /*!< write: Buffer. */ -/*@dependent@*/ char * wrb; /*!< write: Buffer allocated. */ +/*@dependent@*/ char * wrbuf; /*!< write: Buffer. */ +/*@owned@*/ char * wrb; /*!< write: Buffer allocated. */ size_t wrsize; /*!< write: Buffer allocated size. */ size_t wrlen; /*!< write: Number of bytes requested. */ size_t wrnb; /*!< write: Number of bytes returned. */ -/*@owned@*/ FSMI_t iter; /*!< File iterator. */ +/*@only@*/ FSMI_t iter; /*!< File iterator. */ int ix; /*!< Current file iterator index. */ -/*@owned@*/ struct hardLink * links; /*!< Pending hard linked file(s). */ -/*@dependent@*/ struct hardLink * li; /*!< Current hard linked file(s). -/*@null@*/ unsigned int * archiveSize; /*!< Pointer to archive size. */ -/*@dependent@*/ const char ** failedFile; /*!< First file name that failed. */ +/*@only@*/ struct hardLink * links; /*!< Pending hard linked file(s). */ +/*@only@*/ struct hardLink * li; /*!< Current hard linked file(s). */ +/*@kept@*/ unsigned int * archiveSize; /*!< Pointer to archive size. */ +/*@kept@*/ const char ** failedFile; /*!< First file name that failed. */ /*@shared@*/ const char * subdir; /*!< Current file sub-directory. */ char subbuf[64]; /* XXX eliminate */ -/*@shared@*/ const char * osuffix; /*!< Old, preserved, file suffix. */ -/*@shared@*/ const char * nsuffix; /*!< New, created, file suffix. */ +/*@observer@*/ const char * osuffix; /*!< Old, preserved, file suffix. */ +/*@observer@*/ const char * nsuffix; /*!< New, created, file suffix. */ /*@shared@*/ const char * suffix; /*!< Current file suffix. */ char sufbuf[64]; /* XXX eliminate */ -/*@owned@*/ short * dnlx; /*!< Last dirpath verified indexes. */ +/*@only@*/ short * dnlx; /*!< Last dirpath verified indexes. */ /*@only@*/ char * ldn; /*!< Last dirpath verified. */ int ldnlen; /*!< Last dirpath current length. */ int ldnalloc; /*!< Last dirpath allocated length. */ @@ -100,10 +100,10 @@ struct fsm_s { int rc; /*!< External file stage return code. */ int commit; /*!< Commit synchronously? */ cpioMapFlags mapFlags; /*!< Bit(s) to control mapping. */ -/*@dependent@*/ const char * archivePath; /*!< Path to store in cpio archive. */ -/*@dependent@*/ const char * dirName; /*!< File directory name. */ -/*@dependent@*/ const char * baseName; /*!< File base name. */ -/*@dependent@*/ const char * fmd5sum; /*!< File MD5 sum (NULL disables). */ +/*@shared@*/ const char * archivePath; /*!< Path to store in cpio archive. */ +/*@shared@*/ const char * dirName; /*!< File directory name. */ +/*@shared@*/ const char * baseName; /*!< File base name. */ +/*@shared@*/ const char * fmd5sum; /*!< File MD5 sum (NULL disables). */ fileAction action; /*!< File disposition. */ fileStage goal; /*!< Install/build/erase */ fileStage stage; /*!< External file stage. */ @@ -171,12 +171,6 @@ static /*@only@*//*@null@*/ const char * fsmFsPath(/*@null@*/ const FSM_t fsm, /** */ -static inline /*@null@*/ void * mapFree(/*@only@*//*@null@*/ const void * this) { - return _free((void *)this); -} - -/** - */ static /*@null@*/ void * mapFreeIterator(/*@only@*//*@null@*/const void * this) { return _free((void *)this); } @@ -223,7 +217,7 @@ static int mapNextIterator(void * this) { return i; } -int pkgAction(const rpmTransactionSet ts, TFI_t fi, int i, fileStage a) +int pkgAction(const rpmTransactionSet ts, TFI_t fi, int i, /*@unused@*/fileStage a) { int nb = (!ts->chrootDone ? strlen(ts->rootDir) : 0); char * opath = alloca(nb + fi->dnlmax + fi->bnlmax + 64); @@ -434,7 +428,7 @@ static const char * dnlNextIterator(/*@null@*/ DNLI_t dnli) { if (dnli && dnli->active) { TFI_t fi = dnli->fi; - int i; + int i = -1; do { i = (!dnli->reverse ? dnli->i++ : --dnli->i); @@ -529,8 +523,9 @@ static int saveHardLink(FSM_t fsm) if (fsm->goal == FSM_BUILD) --fsm->li->linksLeft; fsm->li->filex[fsm->li->linksLeft] = fsm->ix; fsm->li->files[fsm->li->linksLeft] = xstrdup(fsm->path); - /* XXX this is just an observer pointer. */ + /*@-observertrans@*/ fsm->li->nsuffix[fsm->li->linksLeft] = fsm->nsuffix; + /*@=observertrans@*/ if (fsm->goal == FSM_INSTALL) fsm->li->linksLeft++; #if 0 @@ -742,7 +737,7 @@ static int cpioHeaderWrite(FSM_t fsm, struct stat * st) * @return 0 on success */ static int cpioHeaderRead(FSM_t fsm, struct stat * st) - /*@modifies fsm->cfd, fsm->path, *st @*/ + /*@modifies fsm, *st @*/ { struct cpioCrcPhysicalHeader hdr; int nameSize; @@ -816,6 +811,8 @@ int fsmSetup(FSM_t fsm, fileStage goal, } fsm->iter = mapInitIterator(ts, fi); fsm->archiveSize = archiveSize; + if (fsm->archiveSize) + *fsm->archiveSize = 0; fsm->failedFile = failedFile; if (fsm->failedFile) *fsm->failedFile = NULL; @@ -823,7 +820,7 @@ int fsmSetup(FSM_t fsm, fileStage goal, memset(fsm->sufbuf, 0, sizeof(fsm->sufbuf)); if (fsm->goal != FSM_BUILD) { if (ts->id > 0) - sprintf(fsm->sufbuf, ";%08x", ts->id); + sprintf(fsm->sufbuf, ";%08x", (unsigned)ts->id); } return rc; } @@ -988,44 +985,19 @@ int fsmMapAttrs(FSM_t fsm) * @return 0 on success */ static int expandRegular(FSM_t fsm) - /*@modifies fileSystem, fsm->cfd @*/ + /*@modifies fileSystem, fsm @*/ { const char * fmd5sum; const struct stat * st = &fsm->sb; int left = st->st_size; int rc = 0; -/* XXX HACK_ALERT: something fubar with linked files. */ - fmd5sum = (st->st_nlink == 1 ? fsm->fmd5sum : NULL); - - { - const char * opath = fsm->opath; - const char * path = fsm->path; - - if (fsm->osuffix) - fsm->path = fsmFsPath(fsm, st, NULL, NULL); - rc = fsmStage(fsm, FSM_VERIFY); - if (rc == 0 && fsm->osuffix) { - fsm->opath = fsm->path; - fsm->path = fsmFsPath(fsm, st, NULL, fsm->osuffix); - rc = fsmStage(fsm, FSM_RENAME); -if (!rc) -rpmMessage(RPMMESS_WARNING, _("%s saved as %s\n"), fsm->opath, fsm->path); - fsm->path = _free(fsm->path); - fsm->opath = _free(fsm->opath); - } - - fsm->path = path; - fsm->opath = opath; - } - - if (rc != CPIOERR_LSTAT_FAILED) return rc; - rc = 0; - rc = fsmStage(fsm, FSM_WOPEN); if (rc) goto exit; + fmd5sum = fsm->fmd5sum; + /* XXX This doesn't support brokenEndian checks. */ if (fmd5sum) fdInitMD5(fsm->wfd, 0); @@ -1075,7 +1047,7 @@ exit: * @return 0 on success */ static int writeFile(FSM_t fsm, int writeData) - /*@modifies fsm->cfd @*/ + /*@modifies fsm @*/ { const char * path = fsm->path; const char * opath = fsm->opath; @@ -1108,7 +1080,7 @@ static int writeFile(FSM_t fsm, int writeData) if (writeData && S_ISREG(st->st_mode)) { #if HAVE_MMAP char * rdbuf = NULL; - void * mapped; + void * mapped = (void *)-1; size_t nmapped; #endif @@ -1187,7 +1159,7 @@ exit: * @return 0 on success */ static int writeLinkedFile(FSM_t fsm) - /*@modifies fsm->cfd, *fsm->failedFile @*/ + /*@modifies fsm @*/ { const char * path = fsm->path; int rc = 0; @@ -1339,16 +1311,16 @@ int fsmStage(FSM_t fsm, fileStage stage) case FSM_BUILD: break; case FSM_CREATE: - fsm->path = NULL; + fsm->opath = fsm->path = NULL; fsm->dnlx = _free(fsm->dnlx); fsm->ldn = _free(fsm->ldn); fsm->ldnalloc = fsm->ldnlen = 0; fsm->rdsize = 8 * BUFSIZ; - fsm->rdb = fsm->rdbuf = _free(fsm->rdbuf); - fsm->rdb = fsm->rdbuf = xmalloc(fsm->rdsize); + fsm->rdbuf = fsm->rdb = _free(fsm->rdb); + fsm->rdbuf = fsm->rdb = xmalloc(fsm->rdsize); fsm->wrsize = 8 * BUFSIZ; - fsm->wrb = fsm->wrbuf = _free(fsm->wrbuf); - fsm->wrb = fsm->wrbuf = xmalloc(fsm->wrsize); + fsm->wrbuf = fsm->wrb = _free(fsm->wrb); + fsm->wrbuf = fsm->wrb = xmalloc(fsm->wrsize); fsm->mkdirsdone = 0; fsm->ix = -1; fsm->links = NULL; @@ -1424,7 +1396,6 @@ int fsmStage(FSM_t fsm, fileStage stage) void * dnli = dnlInitIterator(fsm, 0); char * dn = fsm->rdbuf; int dc = dnlCount(dnli); - int i; dn[0] = '\0'; fsm->dnlx = (dc ? xcalloc(dc, sizeof(*fsm->dnlx)) : NULL); @@ -1564,6 +1535,22 @@ int fsmStage(FSM_t fsm, fileStage stage) } if (S_ISREG(st->st_mode)) { + const char * path = fsm->path; + if (fsm->osuffix) + fsm->path = fsmFsPath(fsm, st, NULL, NULL); + rc = fsmStage(fsm, FSM_VERIFY); + if (rc == 0 && fsm->osuffix) { + const char * opath = fsm->opath; + fsm->opath = fsm->path; + fsm->path = fsmFsPath(fsm, st, NULL, fsm->osuffix); + rc = fsmStage(fsm, FSM_RENAME); +if (!rc) +rpmMessage(RPMMESS_WARNING, _("%s saved as %s\n"), fsm->opath, fsm->path); + fsm->path = _free(fsm->path); + fsm->opath = opath; + } + fsm->path = path; + if (rc != CPIOERR_LSTAT_FAILED) return rc; rc = expandRegular(fsm); } else if (S_ISDIR(st->st_mode)) { mode_t st_mode = st->st_mode; @@ -1670,17 +1657,12 @@ opath = _free(opath); fsm->opath = _free(fsm->opath); } if (S_ISLNK(st->st_mode)) { - if (!rc && !getuid() && - !(fsm->diskchecked && st->st_mode == ost->st_mode)) + if (!rc && !getuid()) rc = fsmStage(fsm, FSM_LCHOWN); } else { - if (!rc && !getuid() && - !(fsm->diskchecked && st->st_uid == ost->st_uid - && st->st_uid == ost->st_uid)) + if (!rc && !getuid()) rc = fsmStage(fsm, FSM_CHOWN); - if (!rc && - !(fsm->diskchecked && - (st->st_mode & 07777) == (ost->st_mode & 07777))) + if (!rc) rc = fsmStage(fsm, FSM_CHMOD); if (!rc) rc = fsmStage(fsm, FSM_UTIME); @@ -1712,8 +1694,8 @@ opath = _free(opath); } fsm->ldn = _free(fsm->ldn); fsm->ldnalloc = fsm->ldnlen = 0; - fsm->rdb = fsm->rdbuf = _free(fsm->rdbuf); - fsm->wrb = fsm->wrbuf = _free(fsm->wrbuf); + fsm->rdbuf = fsm->rdb = _free(fsm->rdb); + fsm->wrbuf = fsm->wrb = _free(fsm->wrb); break; case FSM_VERIFY: if (fsm->diskchecked && !fsm->exists) { @@ -1736,8 +1718,8 @@ opath = _free(opath); rc = CPIOERR_UNLINK_FAILED; fsm->path = fsm->opath; fsm->opath = NULL; - return (rc ? rc : CPIOERR_LSTAT_FAILED); - break; + return (rc ? rc : CPIOERR_LSTAT_FAILED); /* XXX HACK */ + /*@notreached@*/ break; } else if (S_ISDIR(st->st_mode)) { if (S_ISDIR(ost->st_mode)) return 0; if (S_ISLNK(ost->st_mode)) { @@ -1768,7 +1750,7 @@ opath = _free(opath); if (fsm->stage == FSM_PROCESS) rc = fsmStage(fsm, FSM_UNLINK); if (rc == 0) rc = CPIOERR_LSTAT_FAILED; return (rc ? rc : CPIOERR_LSTAT_FAILED); /* XXX HACK */ - break; + /*@notreached@*/ break; case FSM_UNLINK: rc = Unlink(fsm->path); @@ -1945,7 +1927,7 @@ opath = _free(opath); rpmMessage(RPMMESS_DEBUG, " %8s (%s, %d, cfd)\trdnb %d\n", cur, (fsm->wrbuf == fsm->wrb ? "wrbuf" : "mmap"), fsm->wrlen, fsm->rdnb); -if (fsm->rdnb != fsm->wrlen) fprintf(stderr, "*** short read, had %d, got %d\n", fsm->rdnb, fsm->wrlen); +if (fsm->rdnb != fsm->wrlen) fprintf(stderr, "*** short read, had %d, got %d\n", (int)fsm->rdnb, (int)fsm->wrlen); #ifdef NOTYET if (Ferror(fsm->rfd)) rc = CPIOERR_READ_FAILED; @@ -1959,7 +1941,7 @@ if (fsm->rdnb != fsm->wrlen) fprintf(stderr, "*** short read, had %d, got %d\n", rpmMessage(RPMMESS_DEBUG, " %8s (%s, %d, cfd)\twrnb %d\n", cur, (fsm->rdbuf == fsm->rdb ? "rdbuf" : "mmap"), fsm->rdnb, fsm->wrnb); -if (fsm->rdnb != fsm->wrnb) fprintf(stderr, "*** short write, had %d, got %d\n", fsm->rdnb, fsm->wrnb); +if (fsm->rdnb != fsm->wrnb) fprintf(stderr, "*** short write, had %d, got %d\n", (int)fsm->rdnb, (int)fsm->wrnb); #ifdef NOTYET if (Ferror(fsm->wfd)) rc = CPIOERR_WRITE_FAILED; @@ -1985,7 +1967,7 @@ if (fsm->rdnb != fsm->wrnb) fprintf(stderr, "*** short write, had %d, got %d\n", if (_fsm_debug && (stage & FSM_SYSCALL)) rpmMessage(RPMMESS_DEBUG, " %8s (rdbuf, %d, rfd)\trdnb %d\n", cur, fsm->rdlen, fsm->rdnb); -if (fsm->rdnb != fsm->rdlen) fprintf(stderr, "*** short read, had %d, got %d\n", fsm->rdnb, fsm->rdlen); +if (fsm->rdnb != fsm->rdlen) fprintf(stderr, "*** short read, had %d, got %d\n", (int)fsm->rdnb, (int)fsm->rdlen); #ifdef NOTYET if (Ferror(fsm->rfd)) rc = CPIOERR_READ_FAILED; @@ -2016,7 +1998,7 @@ if (fsm->rdnb != fsm->rdlen) fprintf(stderr, "*** short read, had %d, got %d\n", if (_fsm_debug && (stage & FSM_SYSCALL)) rpmMessage(RPMMESS_DEBUG, " %8s (wrbuf, %d, wfd)\twrnb %d\n", cur, fsm->rdnb, fsm->wrnb); -if (fsm->rdnb != fsm->wrnb) fprintf(stderr, "*** short write: had %d, got %d\n", fsm->rdnb, fsm->wrnb); +if (fsm->rdnb != fsm->wrnb) fprintf(stderr, "*** short write: had %d, got %d\n", (int)fsm->rdnb, (int)fsm->wrnb); #ifdef NOTYET if (Ferror(fsm->wfd)) rc = CPIOERR_WRITE_FAILED; @@ -2099,7 +2081,7 @@ exit: int cpioBuildArchive(FSM_t fsm) { size_t pos = fdGetCpioPos(fsm->cfd); - int rc; + int rc = 0; while (1) { diff --git a/lib/depends.c b/lib/depends.c index 48b13aa13..705b047eb 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -19,6 +19,11 @@ int _depends_debug = 0; /*@access rpmdb@*/ /* XXX compared with NULL */ /*@access rpmTransactionSet@*/ +static /*@null@*/ void * _free(/*@only@*/ /*@null@*/ const void * this) { + if (this) free((void *)this); + return NULL; +} + int headerNVR(Header h, const char **np, const char **vp, const char **rp) { int type, count; @@ -120,9 +125,7 @@ static void alFreeIndex(struct availableList * al) /*@modifies al->index @*/ { if (al->index.size) { - if (al->index.index) - free(al->index.index); - al->index.index = NULL; + al->index.index = _free(al->index.index); al->index.size = 0; } } @@ -151,6 +154,7 @@ static void alCreate(struct availableList * al) */ static void alFree(struct availableList * al) { + HFD_t hfd = headerFreeData; struct availablePackage * p; rpmRelocation * r; int i; @@ -161,40 +165,37 @@ static void alFree(struct availableList * al) while ((tsi = p->tsi.tsi_next) != NULL) { p->tsi.tsi_next = tsi->tsi_next; tsi->tsi_next = NULL; - free(tsi); + tsi = _free(tsi); } } - if (p->provides) free(p->provides); - if (p->providesEVR) free(p->providesEVR); - if (p->requires) free(p->requires); - if (p->requiresEVR) free(p->requiresEVR); - if (p->baseNames) free(p->baseNames); + p->provides = hfd(p->provides, -1); + p->providesEVR = hfd(p->providesEVR, -1); + p->requires = hfd(p->requires, -1); + p->requiresEVR = hfd(p->requiresEVR, -1); + p->baseNames = hfd(p->baseNames, -1); if (p->h) headerFree(p->h); if (p->relocs) { for (r = p->relocs; (r->oldPath || r->newPath); r++) { - if (r->oldPath) free((void *)r->oldPath); - if (r->newPath) free((void *)r->newPath); + r->oldPath = _free(r->oldPath); + r->newPath = _free(r->newPath); } - free(p->relocs); + p->relocs = _free(p->relocs); } if (p->fd) p->fd = fdFree(p->fd, "alAddPackage (alFree)"); } for (i = 0; i < al->numDirs; i++) { - free((void *)al->dirs[i].dirName); - free(al->dirs[i].files); + al->dirs[i].dirName = _free(al->dirs[i].dirName); + al->dirs[i].files = _free(al->dirs[i].files); } - if (al->numDirs) - free(al->dirs); - al->dirs = NULL; - + if (al->numDirs && al->dirs) + al->dirs = _free(al->dirs); if (al->alloced && al->list) - free(al->list); - al->list = NULL; + al->list = _free(al->list); alFreeIndex(al); } @@ -230,6 +231,9 @@ static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList Header h, /*@dependent@*/ const void * key, FD_t fd, rpmRelocation * relocs) { + HGE_t hge = (HGE_t)headerGetEntryMinMemory; + HFD_t hfd = headerFreeData; + int dnt, bnt; struct availablePackage * p; rpmRelocation * r; int i; @@ -263,13 +267,13 @@ static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList * XXX However, there is logic in files.c/depends.c that checks for * XXX existence (rather than value) that will need to change as well. */ - if (headerGetEntry(p->h, RPMTAG_MULTILIBS, NULL, (void **) &pp, NULL)) + if (hge(p->h, RPMTAG_MULTILIBS, NULL, (void **) &pp, NULL)) multiLibMask = *pp; if (multiLibMask) { for (i = 0; i < pkgNum - 1; i++) { if (!strcmp (p->name, al->list[i].name) - && headerGetEntry(al->list[i].h, RPMTAG_MULTILIBS, NULL, + && hge(al->list[i].h, RPMTAG_MULTILIBS, NULL, (void **) &pp, NULL) && !rpmVersionCompare(p->h, al->list[i].h) && *pp && !(*pp & multiLibMask)) @@ -277,54 +281,51 @@ static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList } } - if (!headerGetEntry(h, RPMTAG_EPOCH, NULL, (void **) &p->epoch, NULL)) + if (!hge(h, RPMTAG_EPOCH, NULL, (void **) &p->epoch, NULL)) p->epoch = NULL; - if (!headerGetEntry(h, RPMTAG_PROVIDENAME, NULL, (void **) &p->provides, + if (!hge(h, RPMTAG_PROVIDENAME, NULL, (void **) &p->provides, &p->providesCount)) { p->providesCount = 0; p->provides = NULL; p->providesEVR = NULL; p->provideFlags = NULL; } else { - if (!headerGetEntry(h, RPMTAG_PROVIDEVERSION, + if (!hge(h, RPMTAG_PROVIDEVERSION, NULL, (void **) &p->providesEVR, NULL)) p->providesEVR = NULL; - if (!headerGetEntry(h, RPMTAG_PROVIDEFLAGS, + if (!hge(h, RPMTAG_PROVIDEFLAGS, NULL, (void **) &p->provideFlags, NULL)) p->provideFlags = NULL; } - if (!headerGetEntry(h, RPMTAG_REQUIRENAME, NULL, (void **) &p->requires, + if (!hge(h, RPMTAG_REQUIRENAME, NULL, (void **) &p->requires, &p->requiresCount)) { p->requiresCount = 0; p->requires = NULL; p->requiresEVR = NULL; p->requireFlags = NULL; } else { - if (!headerGetEntry(h, RPMTAG_REQUIREVERSION, + if (!hge(h, RPMTAG_REQUIREVERSION, NULL, (void **) &p->requiresEVR, NULL)) p->requiresEVR = NULL; - if (!headerGetEntry(h, RPMTAG_REQUIREFLAGS, + if (!hge(h, RPMTAG_REQUIREFLAGS, NULL, (void **) &p->requireFlags, NULL)) p->requireFlags = NULL; } - if (!headerGetEntryMinMemory(h, RPMTAG_BASENAMES, NULL, - (const void **) &p->baseNames, &p->filesCount)) + if (!hge(h, RPMTAG_BASENAMES, &bnt, (void **) &p->baseNames, &p->filesCount)) { p->filesCount = 0; p->baseNames = NULL; } else { - headerGetEntryMinMemory(h, RPMTAG_DIRNAMES, NULL, - (const void **) &dirNames, &numDirs); - headerGetEntryMinMemory(h, RPMTAG_DIRINDEXES, NULL, - (const void **) &dirIndexes, NULL); - headerGetEntry(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlags, NULL); + hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, &numDirs); + hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL); + hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlags, NULL); /* XXX FIXME: We ought to relocate the directory list here */ - dirMapping = alloca(sizeof(*dirMapping) * numDirs); + dirMapping = alloca(sizeof(*dirMapping) * numDirs); /* allocated enough space for all the directories we could possible need to add */ @@ -349,7 +350,7 @@ static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList } } - free(dirNames); + dirNames = hfd(dirNames, dnt); first = 0; while (first < p->filesCount) { @@ -601,6 +602,9 @@ typedef int (*dbrecMatch_t) (Header h, const char *reqName, const char * reqEVR, static int rangeMatchesDepFlags (Header h, const char *reqName, const char * reqEVR, int reqFlags) { + HGE_t hge = (HGE_t)headerGetEntryMinMemory; + HFD_t hfd = headerFreeData; + int pnt, pvt; const char ** provides; const char ** providesEVR; int_32 * provideFlags; @@ -617,16 +621,15 @@ static int rangeMatchesDepFlags (Header h, const char *reqName, const char * req * Rpm prior to 3.0.3 does not have versioned provides. * If no provides version info is available, match any requires. */ - if (!headerGetEntry(h, RPMTAG_PROVIDEVERSION, &type, + if (!hge(h, RPMTAG_PROVIDEVERSION, &pvt, (void **) &providesEVR, &providesCount)) return 1; - headerGetEntry(h, RPMTAG_PROVIDEFLAGS, &type, - (void **) &provideFlags, &providesCount); + hge(h, RPMTAG_PROVIDEFLAGS, &type, (void **) &provideFlags, &providesCount); - if (!headerGetEntry(h, RPMTAG_PROVIDENAME, &type, - (void **) &provides, &providesCount)) { - if (providesEVR) free((void *)providesEVR); + if (!hge(h, RPMTAG_PROVIDENAME, &pnt, (void **) &provides, &providesCount)) + { + providesEVR = hfd(providesEVR, pvt); return 0; /* XXX should never happen */ } @@ -645,8 +648,8 @@ static int rangeMatchesDepFlags (Header h, const char *reqName, const char * req break; } - if (provides) free((void *)provides); - if (providesEVR) free((void *)providesEVR); + provides = hfd(provides, pnt); + providesEVR = hfd(providesEVR, pvt); return result; } @@ -654,6 +657,7 @@ static int rangeMatchesDepFlags (Header h, const char *reqName, const char * req int headerMatchesDepFlags(Header h, const char * reqName, const char * reqEVR, int reqFlags) { + HGE_t hge = (HGE_t)headerGetEntryMinMemory; const char *name, *version, *release; int_32 * epoch; const char *pkgEVR; @@ -668,7 +672,7 @@ int headerMatchesDepFlags(Header h, pkgEVR = p = alloca(21 + strlen(version) + 1 + strlen(release) + 1); *p = '\0'; - if (headerGetEntry(h, RPMTAG_EPOCH, NULL, (void **) &epoch, NULL)) { + if (hge(h, RPMTAG_EPOCH, NULL, (void **) &epoch, NULL)) { sprintf(p, "%d:", *epoch); while (*p) p++; @@ -756,6 +760,9 @@ static void removePackage(rpmTransactionSet ts, int dboffset, int depends) int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd, const void * key, int upgrade, rpmRelocation * relocs) { + HGE_t hge = (HGE_t)headerGetEntryMinMemory; + HFD_t hfd = headerFreeData; + int ont, ovt; /* this is an install followed by uninstalls */ const char * name; int count; @@ -796,9 +803,9 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd, else { uint_32 *p, multiLibMask = 0, oldmultiLibMask = 0; - if (headerGetEntry(h2, RPMTAG_MULTILIBS, NULL, (void **) &p, NULL)) + if (hge(h2, RPMTAG_MULTILIBS, NULL, (void **) &p, NULL)) oldmultiLibMask = *p; - if (headerGetEntry(h, RPMTAG_MULTILIBS, NULL, (void **) &p, NULL)) + if (hge(h, RPMTAG_MULTILIBS, NULL, (void **) &p, NULL)) multiLibMask = *p; if (oldmultiLibMask && multiLibMask && !(oldmultiLibMask & multiLibMask)) { @@ -809,13 +816,13 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd, rpmdbFreeIterator(mi); } - if (headerGetEntry(h, RPMTAG_OBSOLETENAME, NULL, (void **) &obsoletes, &count)) { + if (hge(h, RPMTAG_OBSOLETENAME, &ont, (void **) &obsoletes, &count)) { const char **obsoletesEVR; int_32 *obsoletesFlags; int j; - headerGetEntry(h, RPMTAG_OBSOLETEVERSION, NULL, (void **) &obsoletesEVR, NULL); - headerGetEntry(h, RPMTAG_OBSOLETEFLAGS, NULL, (void **) &obsoletesFlags, NULL); + hge(h, RPMTAG_OBSOLETEVERSION, &ovt, (void **) &obsoletesEVR, NULL); + hge(h, RPMTAG_OBSOLETEFLAGS, NULL, (void **) &obsoletesFlags, NULL); for (j = 0; j < count; j++) { @@ -847,8 +854,8 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd, } } - if (obsoletesEVR) free(obsoletesEVR); - free(obsoletes); + obsoletesEVR = hfd(obsoletesEVR, ovt); + obsoletes = hfd(obsoletes, ont); } return 0; @@ -1097,7 +1104,7 @@ static int unsatisfiedDepend(rpmTransactionSet ts, * on rpmlib provides. The dependencies look like "rpmlib(YaddaYadda)". * Check those dependencies now. */ - if (!strncmp(keyName, "rpmlib(", sizeof("rpmlib(")-1)) { + if (!strncmp(keyName, "rpmlib(", sizeof("rpmlib(")-1)) { if (rpmCheckRpmlibProvides(keyName, keyEVR, keyFlags)) { rpmMessage(RPMMESS_DEBUG, _("%s: %-45s YES (rpmlib provides)\n"), keyType, keyDepend+2); @@ -1196,6 +1203,10 @@ exit: static int checkPackageDeps(rpmTransactionSet ts, struct problemsSet * psp, Header h, const char * keyName, uint_32 multiLib) { + HGE_t hge = (HGE_t)headerGetEntryMinMemory; + HFD_t hfd = headerFreeData; + int rnt, rvt; + int cnt, cvt; const char * name, * version, * release; const char ** requires; const char ** requiresEVR = NULL; @@ -1212,13 +1223,12 @@ static int checkPackageDeps(rpmTransactionSet ts, struct problemsSet * psp, headerNVR(h, &name, &version, &release); - if (!headerGetEntry(h, RPMTAG_REQUIRENAME, &type, (void **) &requires, - &requiresCount)) { + if (!hge(h, RPMTAG_REQUIRENAME, &rnt, (void **) &requires, &requiresCount)) { requiresCount = 0; } else { - headerGetEntry(h, RPMTAG_REQUIREFLAGS, &type, (void **) &requireFlags, + hge(h, RPMTAG_REQUIREFLAGS, &type, (void **) &requireFlags, &requiresCount); - headerGetEntry(h, RPMTAG_REQUIREVERSION, &type, + hge(h, RPMTAG_REQUIREVERSION, &rvt, (void **) &requiresEVR, &requiresCount); } @@ -1276,17 +1286,17 @@ static int checkPackageDeps(rpmTransactionSet ts, struct problemsSet * psp, } if (requiresCount) { - free(requiresEVR); - free(requires); + requiresEVR = hfd(requiresEVR, rvt); + requires = hfd(requires, rnt); } - if (!headerGetEntry(h, RPMTAG_CONFLICTNAME, &type, (void **) &conflicts, - &conflictsCount)) { + if (!hge(h, RPMTAG_CONFLICTNAME, &cnt, (void **)&conflicts, &conflictsCount)) + { conflictsCount = 0; } else { - headerGetEntry(h, RPMTAG_CONFLICTFLAGS, &type, + hge(h, RPMTAG_CONFLICTFLAGS, &type, (void **) &conflictFlags, &conflictsCount); - headerGetEntry(h, RPMTAG_CONFLICTVERSION, &type, + hge(h, RPMTAG_CONFLICTVERSION, &cvt, (void **) &conflictsEVR, &conflictsCount); } @@ -1315,8 +1325,8 @@ static int checkPackageDeps(rpmTransactionSet ts, struct problemsSet * psp, if (psp->num == psp->alloced) { psp->alloced += 5; - psp->problems = xrealloc(psp->problems, sizeof(*psp->problems) * - psp->alloced); + psp->problems = xrealloc(psp->problems, + sizeof(*psp->problems) * psp->alloced); } psp->problems[psp->num].byHeader = headerLink(h); psp->problems[psp->num].byName = xstrdup(name); @@ -1341,8 +1351,8 @@ static int checkPackageDeps(rpmTransactionSet ts, struct problemsSet * psp, } if (conflictsCount) { - free(conflictsEVR); - free(conflicts); + conflictsEVR = hfd(conflictsEVR, cvt); + conflicts = hfd(conflicts, cnt); } return ourrc; @@ -1899,6 +1909,8 @@ rescan: int rpmdepCheck(rpmTransactionSet ts, struct rpmDependencyConflict ** conflicts, int * numConflicts) { + HGE_t hge = (HGE_t)headerGetEntryMinMemory; + HFD_t hfd = headerFreeData; int npkgs = ts->addedPackages.size; struct availablePackage * p; int i, j; @@ -1919,7 +1931,8 @@ int rpmdepCheck(rpmTransactionSet ts, alMakeIndex(&ts->addedPackages); alMakeIndex(&ts->availablePackages); - /* Look at all of the added packages and make sure their dependencies + /* + * Look at all of the added packages and make sure their dependencies * are satisfied. */ for (i = 0, p = ts->addedPackages.list; i < npkgs; i++, p++) @@ -1940,16 +1953,18 @@ int rpmdepCheck(rpmTransactionSet ts, rc = 0; for (j = 0; j < p->providesCount; j++) { /* Adding: check provides key against conflicts matches. */ - if (checkDependentConflicts(ts, &ps, p->provides[j])) { - rc = 1; - break; - } + if (!checkDependentConflicts(ts, &ps, p->provides[j])) + continue; + rc = 1; + break; } if (rc) goto exit; } - /* now look at the removed packages and make sure they aren't critical */ + /* + * Look at the removed packages and make sure they aren't critical. + */ if (ts->numRemovedPackages > 0) { mi = rpmdbInitIterator(ts->rpmdb, RPMDBI_PACKAGES, NULL, 0); rpmdbAppendIterator(mi, ts->removedPackages, ts->numRemovedPackages); @@ -1966,36 +1981,36 @@ int rpmdepCheck(rpmTransactionSet ts, { const char ** provides; int providesCount; + int pnt; - if (headerGetEntry(h, RPMTAG_PROVIDENAME, NULL, (void **) &provides, - &providesCount)) { + if (hge(h, RPMTAG_PROVIDENAME, &pnt, (void **) &provides, + &providesCount)) + { rc = 0; for (j = 0; j < providesCount; j++) { /* Erasing: check provides against requiredby matches. */ - if (checkDependentPackages(ts, &ps, provides[j])) { + if (!checkDependentPackages(ts, &ps, provides[j])) + continue; rc = 1; break; - } } - free((void *)provides); + provides = hfd(provides, pnt); if (rc) goto exit; } } { const char ** baseNames, ** dirNames; - int_32 * dirIndexes; + int_32 * dirIndexes, dnt, bnt; int fileCount; char * fileName = NULL; int fileAlloced = 0; int len; - if (headerGetEntry(h, RPMTAG_BASENAMES, NULL, - (void **) &baseNames, &fileCount)) { - headerGetEntry(h, RPMTAG_DIRNAMES, NULL, - (void **) &dirNames, NULL); - headerGetEntry(h, RPMTAG_DIRINDEXES, NULL, - (void **) &dirIndexes, NULL); + if (hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &fileCount)) + { + hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL); + hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL); rc = 0; for (j = 0; j < fileCount; j++) { len = strlen(baseNames[j]) + 1 + @@ -2007,15 +2022,15 @@ int rpmdepCheck(rpmTransactionSet ts, *fileName = '\0'; (void) stpcpy( stpcpy(fileName, dirNames[dirIndexes[j]]) , baseNames[j]); /* Erasing: check filename against requiredby matches. */ - if (checkDependentPackages(ts, &ps, fileName)) { - rc = 1; - break; - } + if (!checkDependentPackages(ts, &ps, fileName)) + continue; + rc = 1; + break; } free(fileName); - free(baseNames); - free(dirNames); + baseNames = hfd(baseNames, bnt); + dirNames = hfd(dirNames, dnt); if (rc) goto exit; } diff --git a/lib/install.c b/lib/install.c index cd7e920d4..a4789675b 100644 --- a/lib/install.c +++ b/lib/install.c @@ -12,7 +12,8 @@ #include "misc.h" #include "debug.h" -/*@access Header@*/ /* XXX compared with NULL */ +/*@access Header @*/ /* XXX compared with NULL */ +/*@access rpmTransactionSet @*/ /* XXX compared with NULL */ /** * Macros to be defined from per-header tag values. @@ -664,11 +665,12 @@ int rpmInstallSourcePackage(const char * rootDir, FD_t fd, } rc = rpmtransAddPackage(ts, h, fd, NULL, 0, NULL); - headerFree(h); /* XXX reference held by transaction set */ fi->type = TR_ADDED; fi->ap = ts->addedPackages.list; loadFi(h, fi); + headerFree(h); /* XXX reference held by transaction set */ + if (fi->fmd5s) { /* DYING */ free((void **)fi->fmd5s); fi->fmd5s = NULL; } diff --git a/lib/rollback.c b/lib/rollback.c index ad5ef84a4..7f50481e4 100644 --- a/lib/rollback.c +++ b/lib/rollback.c @@ -10,7 +10,10 @@ #include "debug.h" -/*@access h@*/ /* compared with NULL */ +/*@access Header @*/ /* compared with NULL */ +/*@access rpmTransactionSet @*/ /* compared with NULL */ +/*@access TFI_t @*/ /* compared with NULL */ + static /*@null@*/ void * _free(/*@only@*/ /*@null@*/ const void * this) { if (this) free((void *)this); return NULL; diff --git a/lib/rollback.h b/lib/rollback.h index 573a2ff8e..ec605400d 100644 --- a/lib/rollback.h +++ b/lib/rollback.h @@ -127,19 +127,6 @@ enum fileTypes { }; /** - * Prototype for headerFreeData() vector. - */ -typedef /*@null@*/ - void * (*HFD_t) (/*@only@*/ /*@null@*/ const void * data, rpmTagType type); - -/** - * Prototype for headerGetEntry() vector. - */ -typedef int (*HGE_t) (Header h, int_32 tag, /*@out@*/ int_32 * type, - /*@out@*/ void ** p, /*@out@*/int_32 * c) - /*@modifies *type, *p, *c @*/; - -/** */ struct transactionFileInfo_s { /* for all packages */ @@ -283,41 +270,48 @@ int pkgActions(const rpmTransactionSet ts, TFI_t fi, fileStage a); * @return 0 on success */ int fsmSetup(FSM_t fsm, fileStage goal, - const rpmTransactionSet ts, const TFI_t fi, FD_t cfd, - unsigned int * archiveSize, const char ** failedFile); + /*@kept@*/ const rpmTransactionSet ts, + /*@kept@*/ const TFI_t fi, + FD_t cfd, + /*@out@*/ unsigned int * archiveSize, + /*@out@*/ const char ** failedFile) + /*@modifies fsm, *archiveSize, *failedFile @*/; /** * Clean file state machine. * @param fsm file state machine data * @return 0 on success */ -int fsmTeardown(FSM_t fsm); +int fsmTeardown(FSM_t fsm) + /*@modifies fsm @*/; /** * Retrieve transaction set from file state machine iterator. * @param fsm file state machine data * @return transaction set */ -/*@dependent@*/ rpmTransactionSet fsmGetTs(const FSM_t fsm); +/*@kept@*/ rpmTransactionSet fsmGetTs(const FSM_t fsm) /*@*/; /** * Retrieve transaction element file info from file state machine iterator. * @param fsm file state machine data * @return transaction element file info */ -/*@dependent@*/ TFI_t fsmGetFi(const FSM_t fsm); +/*@kept@*/ TFI_t fsmGetFi(const FSM_t fsm) /*@*/; /** * Map next file path and action. * @param fsm file state machine data */ -int fsmMapPath(FSM_t fsm); +int fsmMapPath(FSM_t fsm) + /*@modifies fsm @*/; /** * Map file stat(2) info. * @param fsm file state machine data */ -int fsmMapAttrs(FSM_t fsm); +int fsmMapAttrs(FSM_t fsm) + /*@modifies fsm @*/; /** * File state machine driver. @@ -325,7 +319,8 @@ int fsmMapAttrs(FSM_t fsm); * @param stage next stage * @return 0 on success */ -int fsmStage(FSM_t fsm, fileStage stage); +int fsmStage(FSM_t fsm, fileStage stage) + /*@modifies fsm @*/; #ifdef __cplusplus } diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 503fcd2d2..b1eb8eaae 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -825,6 +825,19 @@ void rpmProblemSetFree( /*@only@*/ rpmProblemSet probs); /* ==================================================================== */ /** \name RPMTS */ /*@{*/ +/** + * Prototype for headerFreeData() vector. + */ +typedef /*@null@*/ + void * (*HFD_t) (/*@only@*/ /*@null@*/ const void * data, rpmTagType type); + +/** + * Prototype for headerGetEntry() vector. + */ +typedef int (*HGE_t) (Header h, int_32 tag, /*@out@*/ int_32 * type, + /*@out@*/ void ** p, /*@out@*/int_32 * c) + /*@modifies *type, *p, *c @*/; + /* we pass these around as an array with a sentinel */ typedef struct rpmRelocation_s { const char * oldPath; /*!< NULL here evals to RPMTAG_DEFAULTPREFIX, */ @@ -844,7 +857,8 @@ typedef struct rpmRelocation_s { int rpmInstallSourcePackage(const char * root, FD_t fd, /*@out@*/ const char ** specFile, rpmCallbackFunction notify, rpmCallbackData notifyData, - /*@out@*/ char ** cookie); + /*@out@*/ char ** cookie) + /*@modifies *specFile, *cookie @*/; /** * Compare headers to determine which header is "newer". diff --git a/lib/transaction.c b/lib/transaction.c index 8f8831fc3..d280b1633 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -821,6 +821,9 @@ static int handleInstInstalledFiles(TFI_t fi, rpmdb db, rpmProblemSet probs, rpmtransFlags transFlags) { + HGE_t hge = fi->hge; + HFD_t hfd = fi->hfd; + int oltype, omtype; Header h; int i; const char ** otherMd5s; @@ -840,18 +843,12 @@ static int handleInstInstalledFiles(TFI_t fi, rpmdb db, return 1; } - headerGetEntryMinMemory(h, RPMTAG_FILEMD5S, NULL, - (const void **) &otherMd5s, NULL); - headerGetEntryMinMemory(h, RPMTAG_FILELINKTOS, NULL, - (const void **) &otherLinks, NULL); - headerGetEntryMinMemory(h, RPMTAG_FILESTATES, NULL, - (const void **) &otherStates, NULL); - headerGetEntryMinMemory(h, RPMTAG_FILEMODES, NULL, - (const void **) &otherModes, NULL); - headerGetEntryMinMemory(h, RPMTAG_FILEFLAGS, NULL, - (const void **) &otherFlags, NULL); - headerGetEntryMinMemory(h, RPMTAG_FILESIZES, NULL, - (const void **) &otherSizes, NULL); + hge(h, RPMTAG_FILEMD5S, &omtype, (void **) &otherMd5s, NULL); + hge(h, RPMTAG_FILELINKTOS, &oltype, (void **) &otherLinks, NULL); + hge(h, RPMTAG_FILESTATES, NULL, (void **) &otherStates, NULL); + hge(h, RPMTAG_FILEMODES, NULL, (void **) &otherModes, NULL); + hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &otherFlags, NULL); + hge(h, RPMTAG_FILESIZES, NULL, (void **) &otherSizes, NULL); fi->replaced = xmalloc(sizeof(*fi->replaced) * sharedCount); @@ -901,8 +898,8 @@ static int handleInstInstalledFiles(TFI_t fi, rpmdb db, fi->replacedSizes[fileNum] = otherSizes[otherFileNum]; } - free(otherMd5s); - free(otherLinks); + otherMd5s = hfd(otherMd5s, omtype); + otherLinks = hfd(otherLinks, oltype); rpmdbFreeIterator(mi); fi->replaced = xrealloc(fi->replaced, /* XXX memory leak */ @@ -916,21 +913,22 @@ static int handleRmvdInstalledFiles(TFI_t fi, rpmdb db, struct sharedFileInfo * shared, int sharedCount) { + HGE_t hge = fi->hge; Header h; const char * otherStates; int i; rpmdbMatchIterator mi; - mi = rpmdbInitIterator(db, RPMDBI_PACKAGES, &shared->otherPkg, sizeof(shared->otherPkg)); + mi = rpmdbInitIterator(db, RPMDBI_PACKAGES, + &shared->otherPkg, sizeof(shared->otherPkg)); h = rpmdbNextIterator(mi); if (h == NULL) { rpmdbFreeIterator(mi); return 1; } - headerGetEntryMinMemory(h, RPMTAG_FILESTATES, NULL, - (const void **) &otherStates, NULL); + hge(h, RPMTAG_FILESTATES, NULL, (void **) &otherStates, NULL); for (i = 0; i < sharedCount; i++, shared++) { int otherFileNum, fileNum; |