diff options
| author | Roy Marples <roy@marples.name> | 2008-11-05 13:56:00 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-11-05 13:56:00 +0000 |
| commit | 9783ceb17a8513b0ebcf5fc36d5a42cbd24f1c49 (patch) | |
| tree | d4d4ef38789f070d1033c01be74b3cdfa789d8f8 /bind.c | |
| parent | c93e8528e09c322d105b00711a26cb54f5926422 (diff) | |
| download | dhcpcd-9783ceb17a8513b0ebcf5fc36d5a42cbd24f1c49.tar.xz | |
Close fd's in the child.
Diffstat (limited to 'bind.c')
| -rw-r--r-- | bind.c | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -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) { |
