Skip to content

Commit ba2886f

Browse files
committed
nbd-server: drop the double-fork
... as this breaks as systemd service: This is of type 'forking', so the (first) fork becomes the main and controlling process. The second fork makes the main process exit, and the service is stopped. Calling setsid() should be sufficient to detatch from terminal. Closes: #182
1 parent d1133b7 commit ba2886f

1 file changed

Lines changed: 0 additions & 6 deletions

File tree

nbd-server.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3816,12 +3816,6 @@ void daemonize() {
38163816
if(dup2(2, newfd) < 0) {
38173817
err("dup2 stderr");
38183818
}
3819-
child=fork();
3820-
if(child < 0) {
3821-
err("fork");
3822-
} else if(child > 0) {
3823-
exit(EXIT_SUCCESS);
3824-
}
38253819
FILE*pidf=fopen(pidfname, "w");
38263820
if(pidf) {
38273821
fprintf(pidf,"%d\n", (int)getpid());

0 commit comments

Comments
 (0)