summaryrefslogtreecommitdiffstats
path: root/bind.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-11-05 13:56:00 +0000
committerRoy Marples <roy@marples.name>2008-11-05 13:56:00 +0000
commit9783ceb17a8513b0ebcf5fc36d5a42cbd24f1c49 (patch)
treed4d4ef38789f070d1033c01be74b3cdfa789d8f8 /bind.c
parentc93e8528e09c322d105b00711a26cb54f5926422 (diff)
downloaddhcpcd-9783ceb17a8513b0ebcf5fc36d5a42cbd24f1c49.tar.xz
Close fd's in the child.
Diffstat (limited to 'bind.c')
-rw-r--r--bind.c15
1 files changed, 7 insertions, 8 deletions
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) {