|
@@ -340,6 +340,15 @@ detach_controlling_tty(void)
|
|
|
close(tty_fd);
|
|
close(tty_fd);
|
|
|
#endif
|
|
#endif
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+static pid_t
|
|
|
|
|
+setsid(void)
|
|
|
|
|
+{
|
|
|
|
|
+ setpgid(0, 0);
|
|
|
|
|
+ detach_controlling_tty();
|
|
|
|
|
+
|
|
|
|
|
+ return 0;
|
|
|
|
|
+}
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
static void
|
|
static void
|
|
@@ -357,12 +366,7 @@ daemonize(void)
|
|
|
_exit(0);
|
|
_exit(0);
|
|
|
|
|
|
|
|
/* Create a new session. */
|
|
/* Create a new session. */
|
|
|
-#ifdef HAVE_SETSID
|
|
|
|
|
setsid();
|
|
setsid();
|
|
|
-#else
|
|
|
|
|
- setpgid(0, 0);
|
|
|
|
|
- detach_controlling_tty();
|
|
|
|
|
-#endif
|
|
|
|
|
|
|
|
|
|
pid = fork();
|
|
pid = fork();
|
|
|
if (pid < 0)
|
|
if (pid < 0)
|