Index: squid/src/acl.c diff -u squid/src/acl.c:1.54 squid/src/acl.c:1.6.2.21 --- squid/src/acl.c:1.54 Fri Aug 9 14:46:00 2002 +++ squid/src/acl.c Sat Aug 10 01:54:10 2002 @@ -128,7 +128,7 @@ debug(28, 0) ("strtokFile: %s not found\n", fn); return (NULL); } -#if defined(_SQUID_CYGWIN_) +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) setmode(fileno(aclFile), O_TEXT); #endif aclFromFile = 1; Index: squid/src/cache_cf.c diff -u squid/src/cache_cf.c:1.46 squid/src/cache_cf.c:1.6.10.23 --- squid/src/cache_cf.c:1.46 Sat Jul 6 12:50:20 2002 +++ squid/src/cache_cf.c Mon Jul 15 02:09:05 2002 @@ -275,7 +275,7 @@ if (fp == NULL) fatalf("Unable to open configuration file: %s: %s", file_name, xstrerror()); -#if defined(_SQUID_CYGWIN_) +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) setmode(fileno(fp), O_TEXT); #endif cfg_filename = file_name; Index: squid/src/cache_diff.c diff -u squid/src/cache_diff.c:1.6 squid/src/cache_diff.c:1.4.26.3 --- squid/src/cache_diff.c:1.6 Fri Jan 12 00:20:32 2001 +++ squid/src/cache_diff.c Sun May 6 09:50:19 2001 @@ -137,7 +137,7 @@ fprintf(stderr, "cannot open %s: %s\n", fname, strerror(errno)); return 0; } -#if defined(_SQUID_CYGWIN_) +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) setmode(fileno(file), O_BINARY); #endif scanned_count = cacheIndexScan(idx, fname, file); Index: squid/src/cf_gen.c diff -u squid/src/cf_gen.c:1.13 squid/src/cf_gen.c:1.4.18.8 --- squid/src/cf_gen.c:1.13 Thu Aug 22 05:30:06 2002 +++ squid/src/cf_gen.c Sat Aug 24 00:08:18 2002 @@ -66,7 +66,7 @@ #if HAVE_ASSERT_H #include #endif -#if defined(_SQUID_CYGWIN_) +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) #include #endif #if HAVE_FCNTL_H @@ -158,7 +158,7 @@ perror(input_filename); exit(1); } -#if defined(_SQUID_CYGWIN_) +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) setmode(fileno(fp), O_TEXT); #endif state = sSTART; @@ -345,7 +345,7 @@ perror(output_filename); exit(1); } -#if defined(_SQUID_CYGWIN_) +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) setmode(fileno(fp), O_TEXT); #endif fprintf(fp, @@ -370,7 +370,7 @@ perror(conf_filename); exit(1); } -#if defined(_SQUID_CYGWIN_) +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) setmode(fileno(fp), O_TEXT); #endif gen_conf(entries, fp); Index: squid/src/client.c diff -u squid/src/client.c:1.11 squid/src/client.c:1.3.28.7 --- squid/src/client.c:1.11 Mon Jul 15 14:30:14 2002 +++ squid/src/client.c Tue Jul 16 02:57:54 2002 @@ -223,7 +223,7 @@ xstrerror()); exit(-1); } -#if defined(_SQUID_CYGWIN_) +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) setmode(put_fd, O_BINARY); #endif fstat(put_fd, &sb); Index: squid/src/debug.c diff -u squid/src/debug.c:1.9 squid/src/debug.c:1.3.26.14 --- squid/src/debug.c:1.9 Tue Dec 18 05:38:47 2001 +++ squid/src/debug.c Sat Apr 13 11:40:08 2002 @@ -177,7 +177,7 @@ fflush(stderr); debug_log = stderr; } -#if defined(_SQUID_CYGWIN_) +#if defined(_SQUID_CYGWIN_)||defined(_SQUID_MSWIN_) setmode(fileno(debug_log), O_TEXT); #endif } @@ -237,6 +237,14 @@ snprintf(to, MAXPATHLEN, "%s.%d", debug_log_file, i); rename(from, to); } +/* + * You can't rename open files on Microsoft "operating systems" + * so we close before renaming. + */ +#ifdef _SQUID_MSWIN_ + if (debug_log != stderr) + fclose(debug_log); +#endif /* Rotate the current log to .0 */ if (Config.Log.rotateNumber > 0) { snprintf(to, MAXPATHLEN, "%s.%d", debug_log_file, 0); Index: squid/src/disk.c diff -u squid/src/disk.c:1.10 squid/src/disk.c:1.4.24.7 --- squid/src/disk.c:1.10 Thu Aug 8 13:15:19 2002 +++ squid/src/disk.c Sat Aug 10 01:54:10 2002 @@ -92,7 +92,7 @@ read_callback(-1, F->read_data); } if (F->flags.write_daemon) { -#if defined(_SQUID_MSWIN_) || defined(_SQUID_OS2_) || defined (_SQUID_CYGWIN_) +#if defined(_SQUID_MSWIN_) || defined(_SQUID_OS2_) || defined(_SQUID_CYGWIN_) /* * on some operating systems, you can not delete or rename * open files, so we won't allow delayed close. Index: squid/src/mime.c diff -u squid/src/mime.c:1.11 squid/src/mime.c:1.6.2.7 --- squid/src/mime.c:1.11 Tue Nov 13 14:19:33 2001 +++ squid/src/mime.c Tue Nov 20 13:10:31 2001 @@ -297,7 +297,7 @@ debug(50, 1) ("mimeInit: %s: %s\n", filename, xstrerror()); return; } -#if defined (_SQUID_CYGWIN_) +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) setmode(fileno(fp), O_TEXT); #endif mimeFreeMemory(); Index: squid/src/squid.h diff -u squid/src/squid.h:1.18 squid/src/squid.h:1.3.22.10 --- squid/src/squid.h:1.18 Fri Aug 9 14:46:02 2002 +++ squid/src/squid.h Sat Aug 10 01:54:11 2002 @@ -202,7 +202,7 @@ #if HAVE_LIMITS_H #include #endif -#if defined(_SQUID_CYGWIN_) +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) #include #endif Index: squid/src/tools.c diff -u squid/src/tools.c:1.25 squid/src/tools.c:1.7.2.28 --- squid/src/tools.c:1.25 Thu Aug 22 05:30:08 2002 +++ squid/src/tools.c Sat Aug 24 00:08:18 2002 @@ -895,6 +895,9 @@ xrename(const char *from, const char *to) { debug(21, 2) ("xrename: renaming %s to %s\n", from, to); +#ifdef _SQUID_MSWIN_ + remove(to); +#endif if (0 == rename(from, to)) return 0; debug(21, errno == ENOENT ? 2 : 1) ("xrename: Cannot rename %s to %s: %s\n", Index: squid/src/fs/ufs/store_dir_ufs.c diff -u squid/src/fs/ufs/store_dir_ufs.c:1.30 squid/src/fs/ufs/store_dir_ufs.c:1.5.10.19 --- squid/src/fs/ufs/store_dir_ufs.c:1.30 Fri Aug 9 14:46:06 2002 +++ squid/src/fs/ufs/store_dir_ufs.c Sun Aug 11 09:45:10 2002 @@ -860,7 +860,7 @@ char *new_path = xstrdup(storeUfsDirSwapLogFile(sd, ".new")); int fd; file_close(ufsinfo->swaplog_fd); -#if defined (_SQUID_OS2_) || defined (_SQUID_CYGWIN_) +#if defined(_SQUID_OS2_) || defined(_SQUID_CYGWIN_) || defined(_SQUID_MSWIN_) if (unlink(swaplog_path) < 0) { debug(50, 0) ("%s: %s\n", swaplog_path, xstrerror()); fatal("storeUfsDirCloseTmpSwapLog: unlink failed"); @@ -1060,7 +1060,7 @@ fd = state->fd; /* rename */ if (state->fd >= 0) { -#if defined(_SQUID_OS2_) || defined (_SQUID_CYGWIN_) +#if defined(_SQUID_OS2_) || defined(_SQUID_CYGWIN_) || defined(_SQUID_MSWIN_) file_close(state->fd); state->fd = -1; if (unlink(state->cur) < 0)