diff options
-rw-r--r-- | lib/fsm.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -217,6 +217,16 @@ static int linkSane(FD_t wfd, const char *dest) sb.st_dev == lsb.st_dev && sb.st_ino == lsb.st_ino); } +static void wfd_close(FD_t *wfdp) +{ + if (wfdp && *wfdp) { + int myerrno = errno; + Fclose(*wfdp); + *wfdp = NULL; + errno = myerrno; + } +} + /** \ingroup payload * Create file from payload stream. * @return 0 on success @@ -246,11 +256,7 @@ static int expandRegular(rpmfi fi, const char *dest, rpmpsm psm, int exclusive, if (!nocontent) rc = rpmfiArchiveReadToFilePsm(fi, wfd, nodigest, psm); exit: - if (wfd) { - int myerrno = errno; - Fclose(wfd); - errno = myerrno; - } + wfd_close(&wfd); return rc; } |