return NULL;
rpmcpio_t cpio = xcalloc(1, sizeof(*cpio));
- cpio->fd = fd;
+ cpio->fd = fdLink(fd);
cpio->mode = mode;
cpio->offset = 0;
return cpio;
if ((cpio->mode & O_ACCMODE) == O_WRONLY) {
rc = rpmcpioTrailerWrite(cpio);
}
+ fdFree(cpio->fd);
_free(cpio);
return rc;
}
*/
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. */
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);
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);