]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Hi,
authorrobertc <>
Sun, 3 Aug 2003 16:05:12 +0000 (16:05 +0000)
committerrobertc <>
Sun, 3 Aug 2003 16:05:12 +0000 (16:05 +0000)
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

src/fs/ufs/store_dir_ufs.cc
src/tools.cc

index fe0ff71aca393818dfe1f3ba049bdd5e01700082..387cb4a87edb3d80273ddfb332f0d1d018f8bc9f 100644 (file)
@@ -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);
index af62dc1bf289154bc59d31403bbd02f5779b8438..9f0c988b693de3d04df196751e20b0513359b2ac 100644 (file)
@@ -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);