From: robertc <> Date: Sun, 3 Aug 2003 16:05:12 +0000 (+0000) Subject: Hi, X-Git-Tag: SQUID_3_0_PRE3~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=77dff9d057fa08a6430cfe875abd1429be87e974;p=thirdparty%2Fsquid.git Hi, On Windows (native and Cygwin) and OS/2, when running UFSSwapDir::closeTmpSwapLog() in store_dir_ufs.cc, Squid can be fail if the target file for a rename operation was already deleted. Because xrename() already try to remove the destination target on Windows, a previous unlink() is not needed. This patch extended the native Windows xrename() behaviour to Cygwin and OS/2 too and remove not needed unlink(). Regards Guido --- diff --git a/src/fs/ufs/store_dir_ufs.cc b/src/fs/ufs/store_dir_ufs.cc index fe0ff71aca..387cb4a87e 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.60 2003/07/22 15:23:14 robertc Exp $ + * $Id: store_dir_ufs.cc,v 1.61 2003/08/03 10:05:20 robertc Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -723,14 +723,7 @@ UFSSwapDir::closeTmpSwapLog() char *new_path = xstrdup(logFile(".new")); int fd; file_close(swaplog_fd); -#if defined (_SQUID_OS2_) || defined (_SQUID_WIN32_) - if (::unlink(swaplog_path) < 0) { - debug(50, 0) ("%s: %s\n", swaplog_path, xstrerror()); - fatal("commonUfsDirCloseTmpSwapLog: unlink failed"); - } - -#endif if (xrename(new_path, swaplog_path) < 0) { fatal("commonUfsDirCloseTmpSwapLog: rename failed"); } @@ -973,10 +966,6 @@ UFSSwapDir::writeCleanDone() file_close(state->fd); state->fd = -1; - if (::unlink(state->cur) < 0) - debug(50, 0) ("storeDirWriteCleanLogs: unlinkd failed: %s, %s\n", - xstrerror(), state->cur); - #endif xrename(state->newLog, state->cur); diff --git a/src/tools.cc b/src/tools.cc index af62dc1bf2..9f0c988b69 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.238 2003/06/24 20:53:39 wessels Exp $ + * $Id: tools.cc,v 1.239 2003/08/03 10:05:12 robertc Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -1118,7 +1118,7 @@ int xrename(const char *from, const char *to) { debug(21, 2) ("xrename: renaming %s to %s\n", from, to); -#ifdef _SQUID_MSWIN_ +#if defined (_SQUID_OS2_) || defined (_SQUID_WIN32_) remove (to);