From: Harlan Stenn Date: Thu, 28 Jun 2012 06:28:32 +0000 (-0700) Subject: CID 709169: check return from open("/dev/null", 0) and friends X-Git-Tag: NTP_4_2_7P286~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4811df0247f494e7cfd8b63a969a083b246bb09d;p=thirdparty%2Fntp.git CID 709169: check return from open("/dev/null", 0) and friends bk: 4febf990yCArbG3UG0zzo-2Vxz9vbg --- diff --git a/ChangeLog b/ChangeLog index 104773ad4..c3979b0c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* CID 709169: check return from open("/dev/null", 0) and friends. (4.2.7p285) 2012/06/18 Released by Harlan Stenn * [Bug 2227] Enable mrulist access control via "restrict ... nomrulist". * Automake-1.12 wants us to use AM_PROG_AR. diff --git a/ntpd/ntpd.c b/ntpd/ntpd.c index 589a0c6fc..40e7d9cea 100644 --- a/ntpd/ntpd.c +++ b/ntpd/ntpd.c @@ -604,9 +604,8 @@ ntpdmain( syslogit = TRUE; } close_all_except(waitsync_fd_to_close); - open("/dev/null", 0); - dup2(0, 1); - dup2(0, 2); + INSIST(0 == open("/dev/null", 0) && 1 == dup2(0, 1) \ + && 2 == dup2(0, 2)); init_logging(progname, 0, TRUE); /* we lost our logfile (if any) daemonizing */