From: wessels <> Date: Sat, 9 Dec 2000 07:35:01 +0000 (+0000) Subject: DW broke the write-clean-logs function with a recent patch that X-Git-Tag: SQUID_3_0_PRE1~1739 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b772fd9819b94a256ac3c807285a81fbc2dbfca3;p=thirdparty%2Fsquid.git DW broke the write-clean-logs function with a recent patch that wanted to fix a memory leak. I was passing a NULL pathname to open(). --- diff --git a/src/fs/aufs/store_dir_aufs.cc b/src/fs/aufs/store_dir_aufs.cc index 372f8e1780..6c57d6fefc 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.20 2000/12/05 09:11:30 wessels Exp $ + * $Id: store_dir_aufs.cc,v 1.21 2000/12/09 00:35:01 wessels Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -971,13 +971,14 @@ storeAufsDirWriteCleanStart(SwapDir * sd) struct stat sb; sd->log.clean.write = NULL; sd->log.clean.state = NULL; + state->new = xstrdup(storeAufsDirSwapLogFile(sd, ".clean")); state->fd = file_open(state->new, O_WRONLY | O_CREAT | O_TRUNC); if (state->fd < 0) { + xfree(state->new); xfree(state); return -1; } state->cur = xstrdup(storeAufsDirSwapLogFile(sd, NULL)); - state->new = xstrdup(storeAufsDirSwapLogFile(sd, ".clean")); state->cln = xstrdup(storeAufsDirSwapLogFile(sd, ".last-clean")); state->outbuf = xcalloc(CLEAN_BUF_SZ, 1); state->outbuf_offset = 0; diff --git a/src/fs/coss/store_dir_coss.cc b/src/fs/coss/store_dir_coss.cc index dc876ae987..142be65d87 100644 --- a/src/fs/coss/store_dir_coss.cc +++ b/src/fs/coss/store_dir_coss.cc @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.cc,v 1.11 2000/12/05 09:11:31 wessels Exp $ + * $Id: store_dir_coss.cc,v 1.12 2000/12/09 00:35:04 wessels Exp $ * * DEBUG: section 81 Store COSS Directory Routines * AUTHOR: Eric Stern @@ -467,15 +467,16 @@ storeCossDirWriteCleanStart(SwapDir * sd) CossInfo *cs = (CossInfo *) sd->fsdata; struct _clean_state *state = xcalloc(1, sizeof(*state)); struct stat sb; + state->new = xstrdup(storeCossDirSwapLogFile(sd, ".clean")); state->fd = file_open(state->new, O_WRONLY | O_CREAT | O_TRUNC); if (state->fd < 0) { + xfree(state->new); xfree(state); return -1; } sd->log.clean.write = NULL; sd->log.clean.state = NULL; state->cur = xstrdup(storeCossDirSwapLogFile(sd, NULL)); - state->new = xstrdup(storeCossDirSwapLogFile(sd, ".clean")); state->cln = xstrdup(storeCossDirSwapLogFile(sd, ".last-clean")); state->outbuf = xcalloc(CLEAN_BUF_SZ, 1); state->outbuf_offset = 0; diff --git a/src/fs/diskd/store_dir_diskd.cc b/src/fs/diskd/store_dir_diskd.cc index 020dce40e4..e95564a2fa 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.27 2000/12/05 09:11:31 wessels Exp $ + * $Id: store_dir_diskd.cc,v 1.28 2000/12/09 00:35:04 wessels Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -1162,13 +1162,14 @@ storeDiskdDirWriteCleanStart(SwapDir * sd) struct stat sb; sd->log.clean.write = NULL; sd->log.clean.state = NULL; + state->new = xstrdup(storeDiskdDirSwapLogFile(sd, ".clean")); state->fd = file_open(state->new, O_WRONLY | O_CREAT | O_TRUNC); if (state->fd < 0) { + xfree(state->new); xfree(state); return -1; } state->cur = xstrdup(storeDiskdDirSwapLogFile(sd, NULL)); - state->new = xstrdup(storeDiskdDirSwapLogFile(sd, ".clean")); state->cln = xstrdup(storeDiskdDirSwapLogFile(sd, ".last-clean")); state->outbuf = xcalloc(CLEAN_BUF_SZ, 1); state->outbuf_offset = 0; diff --git a/src/fs/ufs/store_dir_ufs.cc b/src/fs/ufs/store_dir_ufs.cc index a7fd5ab9ad..3e47b1138e 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.17 2000/12/05 09:11:34 wessels Exp $ + * $Id: store_dir_ufs.cc,v 1.18 2000/12/09 00:35:05 wessels Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -969,13 +969,14 @@ storeUfsDirWriteCleanStart(SwapDir * sd) struct stat sb; sd->log.clean.write = NULL; sd->log.clean.state = NULL; + state->new = xstrdup(storeUfsDirSwapLogFile(sd, ".clean")); state->fd = file_open(state->new, O_WRONLY | O_CREAT | O_TRUNC); if (state->fd < 0) { + xfree(state->new); xfree(state); return -1; } state->cur = xstrdup(storeUfsDirSwapLogFile(sd, NULL)); - state->new = xstrdup(storeUfsDirSwapLogFile(sd, ".clean")); state->cln = xstrdup(storeUfsDirSwapLogFile(sd, ".last-clean")); state->outbuf = xcalloc(CLEAN_BUF_SZ, 1); state->outbuf_offset = 0;