Add support for systemd style socket activation.
[oweals/tinc.git] / src / tincd.c
index 443301e083f178a501926dd0d383315463c2409b..148e13e444ef2c7ef8188e04baa3e1a189504a55 100644 (file)
@@ -539,6 +539,12 @@ int main(int argc, char **argv) {
 
        g_argv = argv;
 
 
        g_argv = argv;
 
+       if(getenv("LISTEN_PID") && atoi(getenv("LISTEN_PID")) == getpid())
+               do_detach = false;
+#ifdef HAVE_UNSETENV
+       unsetenv("LISTEN_PID");
+#endif
+
        init_configuration(&config_tree);
 
        /* Slllluuuuuuurrrrp! */
        init_configuration(&config_tree);
 
        /* Slllluuuuuuurrrrp! */