From: Roy Marples Date: Wed, 5 Nov 2008 13:56:00 +0000 (+0000) Subject: Close fd's in the child. X-Git-Tag: v5.0.0~193 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9783ceb17a8513b0ebcf5fc36d5a42cbd24f1c49;p=thirdparty%2Fdhcpcd.git Close fd's in the child. --- diff --git a/bind.c b/bind.c index b8c4f913..38cc74fb 100644 --- a/bind.c +++ b/bind.c @@ -81,14 +81,6 @@ daemonise(void) close(sidpipe[0]); write(sidpipe[1], &buf, 1); close(sidpipe[1]); - - break; - default: - signal_reset(); - /* Wait for child to detach */ - close(sidpipe[1]); - read(sidpipe[0], &buf, 1); - close(sidpipe[0]); if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { dup2(fd, STDIN_FILENO); dup2(fd, STDOUT_FILENO); @@ -97,6 +89,13 @@ daemonise(void) close(fd); } break; + default: + signal_reset(); + /* Wait for child to detach */ + close(sidpipe[1]); + read(sidpipe[0], &buf, 1); + close(sidpipe[0]); + break; } /* Done with the fd now */ if (pid != 0) {