From: serassio <> Date: Sun, 20 Aug 2006 15:50:05 +0000 (+0000) Subject: Portability fix: use _PATH_DEVNULL instead of "/dev/null" X-Git-Tag: SQUID_3_0_PRE5~187 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4da086c47184e1b0647602fd278f958a9b677e80;p=thirdparty%2Fsquid.git Portability fix: use _PATH_DEVNULL instead of "/dev/null" --- diff --git a/configure.in b/configure.in index 7603b6a098..d1337a1bf7 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl Configuration input file for Squid dnl -dnl $Id: configure.in,v 1.428 2006/07/31 00:14:48 hno Exp $ +dnl $Id: configure.in,v 1.429 2006/08/20 09:50:05 serassio Exp $ dnl dnl dnl @@ -11,7 +11,7 @@ AM_CONFIG_HEADER(include/autoconf.h) AC_CONFIG_AUX_DIR(cfgaux) AC_CONFIG_SRCDIR([src/main.cc]) AM_INIT_AUTOMAKE([tar-ustar]) -AC_REVISION($Revision: 1.428 $)dnl +AC_REVISION($Revision: 1.429 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AM_MAINTAINER_MODE @@ -1891,6 +1891,7 @@ AC_CHECK_HEADERS( \ openssl/md5.h \ openssl/ssl.h \ openssl/engine.h \ + paths.h \ poll.h \ pwd.h \ shadow.h \ diff --git a/src/defines.h b/src/defines.h index 5bf9264f51..015b4c33f6 100644 --- a/src/defines.h +++ b/src/defines.h @@ -1,6 +1,6 @@ /* - * $Id: defines.h,v 1.119 2006/05/08 23:38:33 robertc Exp $ + * $Id: defines.h,v 1.120 2006/08/20 09:50:05 serassio Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -264,8 +264,12 @@ #define URI_WHITESPACE_DENY 4 #ifndef _PATH_DEVNULL +#ifdef _SQUID_MSWIN_ +#define _PATH_DEVNULL "NUL" +#else #define _PATH_DEVNULL "/dev/null" #endif +#endif /* cbdata macros */ #if CBDATA_DEBUG diff --git a/src/main.cc b/src/main.cc index f6ae20d34c..77bd3c201c 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.430 2006/08/19 12:31:21 robertc Exp $ + * $Id: main.cc,v 1.431 2006/08/20 09:50:05 serassio Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -1521,10 +1521,10 @@ watch_child(char *argv[]) * 1.1.3. execvp had a bit overflow error in a loop.. */ /* Connect stdio to /dev/null in daemon mode */ - nullfd = open("/dev/null", O_RDWR | O_TEXT); + nullfd = open(_PATH_DEVNULL, O_RDWR | O_TEXT); if (nullfd < 0) - fatalf("/dev/null: %s\n", xstrerror()); + fatalf(_PATH_DEVNULL " %s\n", xstrerror()); dup2(nullfd, 0); diff --git a/src/squid.h b/src/squid.h index 15169ff647..e855552034 100644 --- a/src/squid.h +++ b/src/squid.h @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.255 2006/07/02 19:58:34 serassio Exp $ + * $Id: squid.h,v 1.256 2006/08/20 09:50:05 serassio Exp $ * * AUTHOR: Duane Wessels * @@ -78,6 +78,9 @@ #endif #include #endif +#if HAVE_PATHS_H +#include +#endif #if HAVE_PWD_H #include #endif diff --git a/src/unlinkd.cc b/src/unlinkd.cc index a9ea7ab9ce..4b701fbd61 100644 --- a/src/unlinkd.cc +++ b/src/unlinkd.cc @@ -1,6 +1,6 @@ /* - * $Id: unlinkd.cc,v 1.53 2005/11/06 11:16:22 serassio Exp $ + * $Id: unlinkd.cc,v 1.54 2006/08/20 09:50:05 serassio Exp $ * * DEBUG: section 2 Unlink Daemon * AUTHOR: Duane Wessels @@ -50,10 +50,7 @@ main(int argc, char *argv[]) setbuf(stdin, NULL); setbuf(stdout, NULL); close(2); -#ifndef _SQUID_MSWIN_ - - open("/dev/null", O_RDWR); -#endif + open(_PATH_DEVNULL, O_RDWR); while (fgets(buf, UNLINK_BUF_LEN, stdin)) { if ((t = strchr(buf, '\n')))