Re: removing duplicate code

From: Guido Serassio <serassio@dont-contact.us>
Date: Sat, 12 Oct 2002 09:27:44 +0200

Hi Robert,

At 01.57 12/10/2002, Robert Collins wrote:
>I'd like to drop this
>http://www.squid-cache.org/~robertc/ufsduplicate.patch
>into HEAD.
>
>Any objections, otherwise it goes in Tuesday.
>
>Rob

For me is OK too, but, if possible, do you can add the following patch
(based on ufs module) needed from MinGW ?

Regards

Guido

Index: squid/src/fs/ufs/store_dir_ufs.c
diff -u squid/src/fs/ufs/store_dir_ufs.c:1.31
squid/src/fs/ufs/store_dir_ufs.c:1.24.2.12
--- squid/src/fs/ufs/store_dir_ufs.c:1.31 Sun Sep 1 09:30:43 2002
+++ squid/src/fs/ufs/store_dir_ufs.c Fri Sep 20 13:28:08 2002
@@ -214,7 +214,11 @@
         } else {
             fatalf("Swap directory %s is not a directory.", path);
         }
+#ifdef _SQUID_MSWIN_
+ } else if (0 == mkdir(path)) {
+#else
      } else if (0 == mkdir(path, 0755)) {
+#endif
         debug(47, should_exist ? 1 : 3) ("%s created\n", path);
         created = 1;
      } else {
@@ -466,9 +470,9 @@
         tmpe.hash.key = key;
         /* check sizes */
         if (tmpe.swap_file_sz == 0) {
- tmpe.swap_file_sz = sb.st_size;
+ tmpe.swap_file_sz = (size_t) sb.st_size;
         } else if (tmpe.swap_file_sz == sb.st_size - swap_hdr_len) {
- tmpe.swap_file_sz = sb.st_size;
+ tmpe.swap_file_sz = (size_t) sb.st_size;
         } else if (tmpe.swap_file_sz != sb.st_size) {
             debug(47, 1) ("storeUfsDirRebuildFromDirectory: SIZE MISMATCH
%ld!=%ld\n",
                 (long int) tmpe.swap_file_sz, (long int) sb.st_size);
@@ -1168,7 +1172,11 @@
      if (dp == NULL) {
         if (errno == ENOENT) {
             debug(36, 0) ("storeDirClean: WARNING: Creating %s\n", p1);
+#ifdef _SQUID_MSWIN_
+ if (mkdir(p1) == 0)
+#else
             if (mkdir(p1, 0777) == 0)
+#endif
                 return 0;
         }
         debug(50, 0) ("storeDirClean: %s: %s\n", p1, xstrerror());

-
=======================================================
Serassio Guido
Via Albenga, 11/4 10134 - Torino - ITALY
E-mail: guido.serassio@serassio.it
WWW: http://www.serassio.it
Received on Sat Oct 12 2002 - 01:28:06 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:16:55 MST