From: wessels <> Date: Mon, 9 Jun 2003 05:27:50 +0000 (+0000) Subject: check open("/dev/null") return value for errors. Especially important X-Git-Tag: SQUID_3_0_PRE1~147 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e4a1325e3dbaf32e22224ab07536fe856202e870;p=thirdparty%2Fsquid.git check open("/dev/null") return value for errors. Especially important later in ipcCreate() where Squid stays in a do loop if it cannot open /dev/null. --- diff --git a/src/main.cc b/src/main.cc index 24f38b74c0..810729de16 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.379 2003/05/06 00:29:45 hno Exp $ + * $Id: main.cc,v 1.380 2003/06/08 23:27:50 wessels Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -1320,6 +1320,9 @@ watch_child(char *argv[]) /* Connect stdio to /dev/null in daemon mode */ nullfd = open("/dev/null", O_RDWR | O_TEXT); + if (nullfd < 0) + fatalf("/dev/null: %s\n", xstrerror()); + dup2(nullfd, 0); if (opt_debug_stderr < 0) {