diff options
Diffstat (limited to 'other')
-rw-r--r-- | other/bootstrap_serverdaemon/tox_bootstrap_daemon.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/other/bootstrap_serverdaemon/tox_bootstrap_daemon.c b/other/bootstrap_serverdaemon/tox_bootstrap_daemon.c index e82e49cd..f2c54bb1 100644 --- a/other/bootstrap_serverdaemon/tox_bootstrap_daemon.c +++ b/other/bootstrap_serverdaemon/tox_bootstrap_daemon.c | |||
@@ -398,11 +398,14 @@ int main(int argc, char *argv[]) | |||
398 | pid_t pid = fork(); | 398 | pid_t pid = fork(); |
399 | 399 | ||
400 | if (pid < 0) { | 400 | if (pid < 0) { |
401 | fclose(pidf); | ||
401 | syslog(LOG_ERR, "Forking failed. Exiting.\n"); | 402 | syslog(LOG_ERR, "Forking failed. Exiting.\n"); |
402 | return 1; | 403 | return 1; |
403 | } | 404 | } |
404 | 405 | ||
405 | if (pid > 0) { | 406 | if (pid > 0) { |
407 | fprintf(pidf, "%d\n", pid); | ||
408 | fclose(pidf); | ||
406 | syslog(LOG_DEBUG, "Forked successfully: PID: %d.\n", pid); | 409 | syslog(LOG_DEBUG, "Forked successfully: PID: %d.\n", pid); |
407 | return 0; | 410 | return 0; |
408 | } | 411 | } |
@@ -410,9 +413,6 @@ int main(int argc, char *argv[]) | |||
410 | // Change the file mode mask | 413 | // Change the file mode mask |
411 | umask(0); | 414 | umask(0); |
412 | 415 | ||
413 | fprintf(pidf, "%d\n", pid); | ||
414 | fclose(pidf); | ||
415 | |||
416 | // Create a new SID for the child process | 416 | // Create a new SID for the child process |
417 | if (setsid() < 0) { | 417 | if (setsid() < 0) { |
418 | syslog(LOG_ERR, "SID creation failure. Exiting.\n"); | 418 | syslog(LOG_ERR, "SID creation failure. Exiting.\n"); |