Revert "Always return NULL from fdFree()"
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 17 Aug 2012 08:30:43 +0000 (11:30 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 17 Aug 2012 08:37:21 +0000 (11:37 +0300)
- This reverts commit 4c1f7e335de1724661ce63c53186d161ab71a63f:
  various things inside and outside of rpm actually do still depend
  on the old behavior, and leak file descriptors otherwise.
  As an easy backportable band-aid, revert back to the previous
  behavior, to which various callers are tuned to fix the regression
  introduced in rpm 4.10.0. The real fix would be something more like
  "eliminate fdFree() and make Fclose() honor refcounts".

rpmio/rpmio.c

index 3d58451..6feae86 100644 (file)
@@ -353,7 +353,7 @@ FD_t fdFree( FD_t fd)
 {
     if (fd) {
        if (--fd->nrefs > 0)
-           return NULL;
+           return fd;
        fd->stats = _free(fd->stats);
        if (fd->digests) {
            fd->digests = rpmDigestBundleFree(fd->digests);