summaryrefslogtreecommitdiff
path: root/other/bootstrap_daemon
diff options
context:
space:
mode:
Diffstat (limited to 'other/bootstrap_daemon')
-rw-r--r--other/bootstrap_daemon/tox_bootstrap_daemon.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/other/bootstrap_daemon/tox_bootstrap_daemon.c b/other/bootstrap_daemon/tox_bootstrap_daemon.c
index 2c8f7014..0d18d411 100644
--- a/other/bootstrap_daemon/tox_bootstrap_daemon.c
+++ b/other/bootstrap_daemon/tox_bootstrap_daemon.c
@@ -485,8 +485,7 @@ int main(int argc, char *argv[])
485 485
486 // Check if the PID file exists 486 // Check if the PID file exists
487 if (fopen(pid_file_path, "r")) { 487 if (fopen(pid_file_path, "r")) {
488 syslog(LOG_ERR, "Another instance of the daemon is already running, PID file %s exists. Exiting.\n", pid_file_path); 488 syslog(LOG_ERR, "Another instance of the daemon is already running, PID file %s exists.\n", pid_file_path);
489 return 1;
490 } 489 }
491 490
492 IP ip; 491 IP ip;
@@ -555,10 +554,10 @@ int main(int argc, char *argv[])
555 print_public_key(dht->self_public_key); 554 print_public_key(dht->self_public_key);
556 555
557 // Write the PID file 556 // Write the PID file
558 FILE *pidf = fopen(pid_file_path, "w"); 557 FILE *pidf = fopen(pid_file_path, "a+");
559 558
560 if (pidf == NULL) { 559 if (pidf == NULL) {
561 syslog(LOG_ERR, "Can't open the PID file for writing: %s. Exiting.\n", pid_file_path); 560 syslog(LOG_ERR, "Couldn't open the PID file for writing: %s. Exiting.\n", pid_file_path);
562 return 1; 561 return 1;
563 } 562 }
564 563
@@ -575,7 +574,7 @@ int main(int argc, char *argv[])
575 } 574 }
576 575
577 if (pid > 0) { 576 if (pid > 0) {
578 fprintf(pidf, "%d\n", pid); 577 fprintf(pidf, "%d ", pid);
579 fclose(pidf); 578 fclose(pidf);
580 syslog(LOG_DEBUG, "Forked successfully: PID: %d.\n", pid); 579 syslog(LOG_DEBUG, "Forked successfully: PID: %d.\n", pid);
581 return 0; 580 return 0;