Selaa lähdekoodia

s-s-d: Move setsid() alternative code into a replacement setsid() function

Guillem Jover 13 vuotta sitten
vanhempi
commit
1ea1205bd4
1 muutettua tiedostoa jossa 9 lisäystä ja 5 poistoa
  1. 9 5
      utils/start-stop-daemon.c

+ 9 - 5
utils/start-stop-daemon.c

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