--------------------- PatchSet 1054 Date: 2001/01/03 23:52:41 Author: rbcollins Branch: cygwin Tag: (none) Log: added O_BINARY & O_TEXT to defines.h; then removed the #ifdef open .. | O_BINARY's to be just open .. |O_BINARY - makes the code easier to read and the file content is relevant to all platforms. Members: src/defines.h:1.3->1.3.22.1 src/errorpage.c:1.6.10.1->1.6.10.2 src/logfile.c:1.2.30.1->1.2.30.2 src/main.c:1.12.2.1->1.12.2.2 src/mime.c:1.6.2.1->1.6.2.2 src/net_db.c:1.6.16.1->1.6.16.2 src/send-announce.c:1.3.22.1->1.3.22.2 src/tools.c:1.7.2.1->1.7.2.2 src/fs/ufs/store_dir_ufs.c:1.5.10.2->1.5.10.3 src/fs/ufs/store_io_ufs.c:1.2.24.1->1.2.24.2 Index: squid/src/defines.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/defines.h,v retrieving revision 1.3 retrieving revision 1.3.22.1 diff -u -r1.3 -r1.3.22.1 --- squid/src/defines.h 23 Oct 2000 15:04:20 -0000 1.3 +++ squid/src/defines.h 3 Jan 2001 23:52:41 -0000 1.3.22.1 @@ -1,6 +1,6 @@ /* - * $Id: defines.h,v 1.3 2000/10/23 15:04:20 hno Exp $ + * $Id: defines.h,v 1.3.22.1 2001/01/03 23:52:41 rbcollins Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -281,3 +281,10 @@ #ifndef _PATH_DEVNULL #define _PATH_DEVNULL "/dev/null" #endif + +#ifndef O_TEXT +#define O_TEXT 0 +#endif +#ifndef O_BINARY +#define O_BINARY 0 +#endif Index: squid/src/errorpage.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/errorpage.c,v retrieving revision 1.6.10.1 retrieving revision 1.6.10.2 diff -u -r1.6.10.1 -r1.6.10.2 --- squid/src/errorpage.c 3 Jan 2001 15:22:19 -0000 1.6.10.1 +++ squid/src/errorpage.c 3 Jan 2001 23:52:41 -0000 1.6.10.2 @@ -1,6 +1,6 @@ /* - * $Id: errorpage.c,v 1.6.10.1 2001/01/03 15:22:19 rbcollins Exp $ + * $Id: errorpage.c,v 1.6.10.2 2001/01/03 23:52:41 rbcollins Exp $ * * DEBUG: section 4 Error Generation * AUTHOR: Duane Wessels @@ -171,11 +171,7 @@ char *text; snprintf(path, sizeof(path), "%s/%s", dir, page_name); -#if defined (_SQUID_CYGWIN_) fd = file_open(path, O_RDONLY | O_TEXT); -#else - fd = file_open(path, O_RDONLY); -#endif if (fd < 0 || fstat(fd, &sb) < 0) { debug(4, 0) ("errorTryLoadText: '%s': %s\n", path, xstrerror()); if (fd >= 0) Index: squid/src/logfile.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/logfile.c,v retrieving revision 1.2.30.1 retrieving revision 1.2.30.2 diff -u -r1.2.30.1 -r1.2.30.2 --- squid/src/logfile.c 3 Jan 2001 15:22:19 -0000 1.2.30.1 +++ squid/src/logfile.c 3 Jan 2001 23:52:41 -0000 1.2.30.2 @@ -41,11 +41,7 @@ { int fd; Logfile *lf; -#if defined (_SQUID_CYGWIN_) fd = file_open(path, O_WRONLY | O_CREAT | O_TEXT); -#else - fd = file_open(path, O_WRONLY | O_CREAT); -#endif if (DISK_ERROR == fd) { if (ENOENT == errno && fatal_flag) { fatalf("Cannot open '%s' because\n" Index: squid/src/main.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/main.c,v retrieving revision 1.12.2.1 retrieving revision 1.12.2.2 diff -u -r1.12.2.1 -r1.12.2.2 --- squid/src/main.c 3 Jan 2001 15:22:19 -0000 1.12.2.1 +++ squid/src/main.c 3 Jan 2001 23:52:41 -0000 1.12.2.2 @@ -1,6 +1,6 @@ /* - * $Id: main.c,v 1.12.2.1 2001/01/03 15:22:19 rbcollins Exp $ + * $Id: main.c,v 1.12.2.2 2001/01/03 23:52:41 rbcollins Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -845,11 +845,7 @@ syslog(LOG_ALERT, "setsid failed: %s", xstrerror()); closelog(); #ifdef TIOCNOTTY -#if defined(_SQUID_CYGWIN_) if ((i = open("/dev/tty", O_RDWR | O_TEXT)) >= 0) { -#else - if ((i = open("/dev/tty", O_RDWR)) >= 0) { -#endif ioctl(i, TIOCNOTTY, NULL); close(i); } @@ -862,11 +858,7 @@ * 1.1.3. execvp had a bit overflow error in a loop.. */ /* Connect stdio to /dev/null in daemon mode */ -#if defined(_SQUID_CYGWIN_) nullfd = open("/dev/null", O_RDWR | O_TEXT); -#else - nullfd = open("/dev/null", O_RDWR); -#endif dup2(nullfd, 0); if (opt_debug_stderr < 0) { Index: squid/src/mime.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/mime.c,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.2 diff -u -r1.6.2.1 -r1.6.2.2 --- squid/src/mime.c 3 Jan 2001 15:22:19 -0000 1.6.2.1 +++ squid/src/mime.c 3 Jan 2001 23:52:41 -0000 1.6.2.2 @@ -1,6 +1,6 @@ /* - * $Id: mime.c,v 1.6.2.1 2001/01/03 15:22:19 rbcollins Exp $ + * $Id: mime.c,v 1.6.2.2 2001/01/03 23:52:41 rbcollins Exp $ * * DEBUG: section 25 MIME Parsing * AUTHOR: Harvest Derived @@ -409,11 +409,7 @@ if (storeGetPublic(url, METHOD_GET)) return; snprintf(path, MAXPATHLEN, "%s/%s", Config.icons.directory, icon); -#if defined (_SQUID_CYGWIN_) - fd = file_open(path, O_RDONLY); -#else fd = file_open(path, O_RDONLY | O_BINARY); -#endif if (fd < 0) { debug(25, 0) ("mimeLoadIconFile: %s: %s\n", path, xstrerror()); return; Index: squid/src/net_db.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/net_db.c,v retrieving revision 1.6.16.1 retrieving revision 1.6.16.2 diff -u -r1.6.16.1 -r1.6.16.2 --- squid/src/net_db.c 3 Jan 2001 15:22:19 -0000 1.6.16.1 +++ squid/src/net_db.c 3 Jan 2001 23:52:41 -0000 1.6.16.2 @@ -1,6 +1,6 @@ /* - * $Id: net_db.c,v 1.6.16.1 2001/01/03 15:22:19 rbcollins Exp $ + * $Id: net_db.c,v 1.6.16.2 2001/01/03 23:52:41 rbcollins Exp $ * * DEBUG: section 38 Network Measurement Database * AUTHOR: Duane Wessels @@ -435,11 +435,7 @@ * Solaris bugs, its a bad idea. fopen can fail if more than * 256 FDs are open. */ -#if defined (_SQUID_CYGWIN_) fd = file_open(path, O_RDONLY | O_TEXT); -#else - fd = file_open(path, O_RDONLY); -#endif if (fd < 0) return; if (fstat(fd, &sb) < 0) Index: squid/src/send-announce.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/send-announce.c,v retrieving revision 1.3.22.1 retrieving revision 1.3.22.2 diff -u -r1.3.22.1 -r1.3.22.2 --- squid/src/send-announce.c 3 Jan 2001 15:22:19 -0000 1.3.22.1 +++ squid/src/send-announce.c 3 Jan 2001 23:52:41 -0000 1.3.22.2 @@ -1,6 +1,6 @@ /* - * $Id: send-announce.c,v 1.3.22.1 2001/01/03 15:22:19 rbcollins Exp $ + * $Id: send-announce.c,v 1.3.22.2 2001/01/03 23:52:41 rbcollins Exp $ * * DEBUG: section 27 Cache Announcer * AUTHOR: Duane Wessels @@ -88,11 +88,7 @@ strcat(sndbuf, tbuf); l = strlen(sndbuf); if ((file = Config.Announce.file) != NULL) { -#if defined (_SQUID_CYGWIN_) fd = file_open(file, O_RDONLY | O_TEXT); -#else - fd = file_open(file, O_RDONLY); -#endif if (fd > -1 && (n = read(fd, sndbuf + l, BUFSIZ - l - 1)) > 0) { fd_bytes(fd, n, FD_READ); l += n; Index: squid/src/tools.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/tools.c,v retrieving revision 1.7.2.1 retrieving revision 1.7.2.2 diff -u -r1.7.2.1 -r1.7.2.2 --- squid/src/tools.c 3 Jan 2001 15:22:19 -0000 1.7.2.1 +++ squid/src/tools.c 3 Jan 2001 23:52:41 -0000 1.7.2.2 @@ -1,6 +1,6 @@ /* - * $Id: tools.c,v 1.7.2.1 2001/01/03 15:22:19 rbcollins Exp $ + * $Id: tools.c,v 1.7.2.2 2001/01/03 23:52:41 rbcollins Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -578,11 +578,7 @@ return; enter_suid(); old_umask = umask(022); -#if defined(_SQUID_CYGWIN_) fd = file_open(f, O_WRONLY | O_CREAT | O_TRUNC | O_TEXT); -#else - fd = file_open(f, O_WRONLY | O_CREAT | O_TRUNC); -#endif umask(old_umask); leave_suid(); if (fd < 0) { Index: squid/src/fs/ufs/store_dir_ufs.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/ufs/store_dir_ufs.c,v retrieving revision 1.5.10.2 retrieving revision 1.5.10.3 diff -u -r1.5.10.2 -r1.5.10.3 --- squid/src/fs/ufs/store_dir_ufs.c 3 Jan 2001 16:57:52 -0000 1.5.10.2 +++ squid/src/fs/ufs/store_dir_ufs.c 3 Jan 2001 23:52:41 -0000 1.5.10.3 @@ -322,11 +322,7 @@ char *path; int fd; path = storeUfsDirSwapLogFile(sd, NULL); -#if defined(_SQUID_CYGWIN_) fd = file_open(path, O_WRONLY | O_CREAT | O_BINARY); -#else - fd = file_open(path, O_WRONLY | O_CREAT); -#endif if (fd < 0) { debug(50, 1) ("%s: %s\n", path, xstrerror()); fatal("storeUfsDirOpenSwapLog: Failed to open swap log."); @@ -758,11 +754,7 @@ snprintf(rb->fullfilename, SQUID_MAXPATHLEN, "%s/%s", rb->fullpath, rb->entry->d_name); debug(20, 3) ("storeUfsDirGetNextFile: Opening %s\n", rb->fullfilename); -#if defined(_SQUID_CYGWIN_) fd = file_open(rb->fullfilename, O_RDONLY | O_BINARY); -#else - fd = file_open(rb->fullfilename, O_RDONLY); -#endif if (fd < 0) debug(50, 1) ("storeUfsDirGetNextFile: %s: %s\n", rb->fullfilename, xstrerror()); else @@ -877,11 +869,7 @@ if (xrename(new_path, swaplog_path) < 0) { fatal("storeUfsDirCloseTmpSwapLog: rename failed"); } -#if defined(_SQUID_CYGWIN_) fd = file_open(swaplog_path, O_WRONLY | O_CREAT | O_BINARY); -#else - fd = file_open(swaplog_path, O_WRONLY | O_CREAT); -#endif if (fd < 0) { debug(50, 1) ("%s: %s\n", swaplog_path, xstrerror()); fatal("storeUfsDirCloseTmpSwapLog: Failed to open swap log."); @@ -915,11 +903,7 @@ if (ufsinfo->swaplog_fd >= 0) file_close(ufsinfo->swaplog_fd); /* open a write-only FD for the new log */ -#if defined(_SQUID_CYGWIN_) fd = file_open(new_path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY); -#else - fd = file_open(new_path, O_WRONLY | O_CREAT | O_TRUNC); -#endif if (fd < 0) { debug(50, 1) ("%s: %s\n", new_path, xstrerror()); fatal("storeDirOpenTmpSwapLog: Failed to open swap log."); @@ -972,11 +956,7 @@ sd->log.clean.write = NULL; sd->log.clean.state = NULL; state->new = xstrdup(storeUfsDirSwapLogFile(sd, ".clean")); -#if defined(_SQUID_CYGWIN_) state->fd = file_open(state->new, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY); -#else - state->fd = file_open(state->new, O_WRONLY | O_CREAT | O_TRUNC); -#endif if (state->fd < 0) { xfree(state->new); xfree(state); @@ -1098,11 +1078,7 @@ else if (fd < 0) (void) 0; else -#if defined(_SQUID_CYGWIN_) file_close(file_open(state->cln, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY)); -#else - file_close(file_open(state->cln, O_WRONLY | O_CREAT | O_TRUNC)); -#endif /* close */ safe_free(state->cur); safe_free(state->new); Index: squid/src/fs/ufs/store_io_ufs.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/ufs/store_io_ufs.c,v retrieving revision 1.2.24.1 retrieving revision 1.2.24.2 diff -u -r1.2.24.1 -r1.2.24.2 --- squid/src/fs/ufs/store_io_ufs.c 3 Jan 2001 15:22:20 -0000 1.2.24.1 +++ squid/src/fs/ufs/store_io_ufs.c 3 Jan 2001 23:52:41 -0000 1.2.24.2 @@ -54,11 +54,7 @@ struct stat sb; int fd; debug(79, 3) ("storeUfsOpen: fileno %08X\n", f); -#if defined (_SQUID_CYGWIN_) fd = file_open(path, O_RDONLY | O_BINARY); -#else - fd = file_open(path, O_RDONLY); -#endif if (fd < 0) { debug(79, 3) ("storeUfsOpen: got failure (%d)\n", errno); return NULL; @@ -92,11 +88,7 @@ { storeIOState *sio; int fd; -#if defined (_SQUID_CYGWIN_) int mode = (O_WRONLY | O_CREAT | O_TRUNC | O_BINARY); -#else - int mode = (O_WRONLY | O_CREAT | O_TRUNC); -#endif char *path; ufsinfo_t *ufsinfo = (ufsinfo_t *) SD->fsdata; sfileno filn;