diff options
author | Stefan Berger <stefanb@linux.vnet.ibm.com> | 2017-10-26 19:53:43 -0400 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2018-03-28 14:09:16 +0300 |
commit | 5d26889a48c7532f9dbf2aca82e84524e913b02f (patch) | |
tree | 79aa4eb283b1b02810edf476dc08bf03c0e359aa | |
parent | 7c5a3da0b4f52f40025788efec3689c107768ea3 (diff) | |
download | rpm-5d26889a48c7532f9dbf2aca82e84524e913b02f.tar.gz |
Split off function wfd_close() to close a file
(cherry picked from commit e276991614fd127f21aba94946f81f22cb7e6b73)
-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; } |