summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2012-04-17 18:03:29 +0300
committerPanu Matilainen <pmatilai@redhat.com>2012-04-17 18:03:29 +0300
commit00629aa636ab54cabdb4bb7dcd3698ead2024be7 (patch)
tree14b30d327b3f911ba7db93d432232baa338f69e3
parentf1d24281f5d4c48c95709b96bb1d3ea3dbdb22a9 (diff)
downloadrpm-00629aa636ab54cabdb4bb7dcd3698ead2024be7.tar.gz
rpm-00629aa636ab54cabdb4bb7dcd3698ead2024be7.tar.bz2
rpm-00629aa636ab54cabdb4bb7dcd3698ead2024be7.zip
Lose unnecessary cfd member from fsm, refcount through payload instead
-rw-r--r--lib/cpio.c3
-rw-r--r--lib/fsm.c8
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;
}
diff --git a/lib/fsm.c b/lib/fsm.c
index 57032f570..57a38821e 100644
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -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);