vknetd - Fix a bug in previous commit.
authorAntonio Huete Jimenez <tuxillo@quantumachine.net>
Mon, 5 Dec 2011 15:45:45 +0000 (16:45 +0100)
committerAntonio Huete Jimenez <tuxillo@quantumachine.net>
Mon, 5 Dec 2011 15:46:59 +0000 (16:46 +0100)
We have to create pidfile and install signal handlers for the child.

usr.sbin/vknetd/vknetd.c

index 41fe69a..22e7581 100644 (file)
@@ -155,17 +155,18 @@ main(int ac, char **av)
                exit(1);
        }
 
+       /*
+        * Now make us a demon and start the threads going.
+        */
+       if (DebugOpt == 0)
+               daemon(1, 0);
+
        writepid();
 
        signal(SIGINT, cleanup);
        signal(SIGHUP, cleanup);
        signal(SIGTERM, cleanup);
 
-       /*
-        * Now make us a demon and start the threads going.
-        */
-       if (DebugOpt == 0)
-               daemon(1, 0);
        pthread_mutex_init(&BridgeMutex, NULL);
        pthread_create(&dummy_td, NULL, vknet_io, tap_info);
        vknet_acceptor(net_fd);