]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Close fd's in the child.
authorRoy Marples <roy@marples.name>
Wed, 5 Nov 2008 13:56:00 +0000 (13:56 +0000)
committerRoy Marples <roy@marples.name>
Wed, 5 Nov 2008 13:56:00 +0000 (13:56 +0000)
bind.c

diff --git a/bind.c b/bind.c
index b8c4f9134bd771f9f869dc1171edf615a424043e..38cc74fbd4757e5bb0d6f0db2dffd0ced308f69e 100644 (file)
--- 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) {