X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;ds=sidebyside;f=src%2Ftincd.c;h=809e6068491d071725a7811028303481486d9c1a;hb=523c80c4e35b7ff8ad94b41a6071dbe2b8ff6ec7;hp=124276f1d0a0b41d1342f58b48ce72ab9f6458a9;hpb=1243156a5e03a666b36bc4400f1402243a85c9a7;p=tinc diff --git a/src/tincd.c b/src/tincd.c index 124276f1..809e6068 100644 --- a/src/tincd.c +++ b/src/tincd.c @@ -181,10 +181,11 @@ int detach(void) close(fd); } - kill(ppid, SIGTERM); - if(setsid() < 0) return -1; + + kill(ppid, SIGTERM); + chdir("/"); /* avoid keeping a mointpoint busy */ openlog(identname, LOG_CONS | LOG_PID, LOG_DAEMON); @@ -343,7 +344,7 @@ main(int argc, char **argv, char **envp) setup_signals(); if(detach()) - cleanup_and_exit(1); + exit(0); if(security_init()) return 1; @@ -432,10 +433,10 @@ RETSIGTYPE sighuh(int a) { if(cp_file) - syslog(LOG_NOTICE, "Got unexpected signal after %s line %d.", - cp_file, cp_line); + syslog(LOG_NOTICE, "Got unexpected signal (%d) after %s line %d.", + a, cp_file, cp_line); else - syslog(LOG_NOTICE, "Got unexpected signal."); + syslog(LOG_NOTICE, "Got unexpected signal (%d).", a); } void @@ -459,6 +460,7 @@ setup_signals(void) signal(SIGINT, sigint_handler); signal(SIGUSR1, sigusr1_handler); signal(SIGUSR2, sigusr2_handler); + signal(SIGCHLD, SIG_IGN); } RETSIGTYPE parent_exit(int a)