diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cpio.c | 3 | ||||
-rw-r--r-- | lib/fsm.c | 8 |
2 files changed, 2 insertions, 9 deletions
diff --git a/lib/cpio.c b/lib/cpio.c index b77b30886..958c12308 100644 --- a/lib/cpio.c +++ b/lib/cpio.c @@ -41,7 +41,7 @@ rpmcpio_t rpmcpioOpen(FD_t fd, char mode) return NULL; rpmcpio_t cpio = xcalloc(1, sizeof(*cpio)); - cpio->fd = fd; + cpio->fd = fdLink(fd); cpio->mode = mode; cpio->offset = 0; return cpio; @@ -327,6 +327,7 @@ int rpmcpioClose(rpmcpio_t cpio) if ((cpio->mode & O_ACCMODE) == O_WRONLY) { rc = rpmcpioTrailerWrite(cpio); } + fdFree(cpio->fd); _free(cpio); return rc; } @@ -96,7 +96,6 @@ struct fsmIterator_s { */ struct fsm_s { char * path; /*!< Current file name. */ - FD_t cfd; /*!< Payload file handle. */ rpmcpio_t archive; /*!< cpio archive */ char * buf; /*!< read: Buffer. */ size_t bufsize; /*!< read: Buffer allocated size. */ @@ -591,9 +590,6 @@ static int fsmSetup(FSM_t fsm, fileStage goal, memset(fsm, 0, sizeof(*fsm)); fsm->ix = -1; fsm->goal = goal; - if (cfd != NULL) { - fsm->cfd = fdLink(cfd); - } fsm->iter = mapInitIterator(ts, te, fi); fsm->sehandle = rpmtsSELabelHandle(ts); @@ -667,10 +663,6 @@ static int fsmTeardown(FSM_t fsm) rc = rpmcpioClose(fsm->archive) || rc; fsm->iter = mapFreeIterator(fsm->iter); - if (fsm->cfd != NULL) { - fsm->cfd = fdFree(fsm->cfd); - fsm->cfd = NULL; - } fsm->failedFile = NULL; fsm->path = _free(fsm->path); |