]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix a leaked opendir() when rebuilding from directory
authorhno <>
Tue, 19 Feb 2002 07:50:01 +0000 (07:50 +0000)
committerhno <>
Tue, 19 Feb 2002 07:50:01 +0000 (07:50 +0000)
(the last opendir was never closed)

src/fs/aufs/store_dir_aufs.cc
src/fs/diskd/store_dir_diskd.cc
src/fs/ufs/store_dir_ufs.cc

index 4db0718d8fdca99750e25876abd61326bebc8a33..48798ed7e5c3625d578432697fb3407b784783a3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_aufs.cc,v 1.40 2001/11/13 18:11:19 hno Exp $
+ * $Id: store_dir_aufs.cc,v 1.41 2002/02/19 00:50:01 hno Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -715,9 +715,6 @@ storeAufsDirGetNextFile(RebuildState * rb, sfileno * filn_p, int *size)
            snprintf(rb->fullpath, SQUID_MAXPATHLEN, "%s/%02X/%02X",
                rb->sd->path,
                rb->curlvl1, rb->curlvl2);
-           if (rb->flags.init && rb->td != NULL)
-               closedir(rb->td);
-           rb->td = NULL;
            if (dirs_opened)
                return -1;
            rb->td = opendir(rb->fullpath);
@@ -760,6 +757,9 @@ storeAufsDirGetNextFile(RebuildState * rb, sfileno * filn_p, int *size)
                store_open_disk_fd++;
            continue;
        }
+       if (rb->td != NULL)
+           closedir(rb->td);
+       rb->td = NULL;
        rb->in_dir = 0;
        if (++rb->curlvl2 < aioinfo->l2)
            continue;
index b73f4721dff4272c4798b9a251f327af92c26b54..5beb4eb4384a9d4240f5644d0bd55e93a0bb0f3c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_diskd.cc,v 1.58 2001/11/13 18:11:20 hno Exp $
+ * $Id: store_dir_diskd.cc,v 1.59 2002/02/19 00:50:01 hno Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -905,9 +905,6 @@ storeDiskdDirGetNextFile(RebuildState * rb, sfileno * filn_p, int *size)
            snprintf(rb->fullpath, SQUID_MAXPATHLEN, "%s/%02X/%02X",
                rb->sd->path,
                rb->curlvl1, rb->curlvl2);
-           if (rb->flags.init && rb->td != NULL)
-               closedir(rb->td);
-           rb->td = NULL;
            if (dirs_opened)
                return -1;
            rb->td = opendir(rb->fullpath);
@@ -950,6 +947,9 @@ storeDiskdDirGetNextFile(RebuildState * rb, sfileno * filn_p, int *size)
                store_open_disk_fd++;
            continue;
        }
+       if (rb->td != NULL)
+           closedir(rb->td);
+       rb->td = NULL;
        rb->in_dir = 0;
        if (++rb->curlvl2 < diskdinfo->l2)
            continue;
index bc7d066e5638c97021fd995317f167eb61eb8ba8..b387f7339d3f8a4538367469be82c5dda3b0e643 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_ufs.cc,v 1.39 2001/11/13 18:11:21 hno Exp $
+ * $Id: store_dir_ufs.cc,v 1.40 2002/02/19 00:50:01 hno Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -714,9 +714,6 @@ storeUfsDirGetNextFile(RebuildState * rb, sfileno * filn_p, int *size)
                rb->sd->path,
                rb->curlvl1,
                rb->curlvl2);
-           if (rb->flags.init && rb->td != NULL)
-               closedir(rb->td);
-           rb->td = NULL;
            if (dirs_opened)
                return -1;
            rb->td = opendir(rb->fullpath);
@@ -759,6 +756,9 @@ storeUfsDirGetNextFile(RebuildState * rb, sfileno * filn_p, int *size)
                store_open_disk_fd++;
            continue;
        }
+       if (rb->td != NULL)
+           closedir(rb->td);
+       rb->td = NULL;
        rb->in_dir = 0;
        if (++rb->curlvl2 < ufsinfo->l2)
            continue;