summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortawm <tom@tombartelt.com>2014-01-30 15:56:45 -0500
committertawm <tom@tombartelt.com>2014-01-30 15:56:45 -0500
commit04580cf122f4b85bd9f49a7d2c7f4df7299ed9d7 (patch)
tree5b23b046521a9ecee43424d23e9bed380096868e
parenta13e30e8bb59f60b4971b0d46dd573ffe7b44104 (diff)
Fixed PID forgetfulness.
-rw-r--r--other/bootstrap_serverdaemon/tox_bootstrap_daemon.c6
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");