From: hno <> Date: Tue, 19 Feb 2002 07:50:01 +0000 (+0000) Subject: Fix a leaked opendir() when rebuilding from directory X-Git-Tag: SQUID_3_0_PRE1~1178 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79416078ad1a91de7fdeb89cc61ddbcb90e5cffd;p=thirdparty%2Fsquid.git Fix a leaked opendir() when rebuilding from directory (the last opendir was never closed) --- diff --git a/src/fs/aufs/store_dir_aufs.cc b/src/fs/aufs/store_dir_aufs.cc index 4db0718d8f..48798ed7e5 100644 --- a/src/fs/aufs/store_dir_aufs.cc +++ b/src/fs/aufs/store_dir_aufs.cc @@ -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; diff --git a/src/fs/diskd/store_dir_diskd.cc b/src/fs/diskd/store_dir_diskd.cc index b73f4721df..5beb4eb438 100644 --- a/src/fs/diskd/store_dir_diskd.cc +++ b/src/fs/diskd/store_dir_diskd.cc @@ -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; diff --git a/src/fs/ufs/store_dir_ufs.cc b/src/fs/ufs/store_dir_ufs.cc index bc7d066e56..b387f7339d 100644 --- a/src/fs/ufs/store_dir_ufs.cc +++ b/src/fs/ufs/store_dir_ufs.cc @@ -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;