Increase verbosity and don't exit if PID file cannot be read

This commit is contained in:
DL6ER
2017-04-03 15:24:06 +02:00
parent 890484569a
commit 82aed82bf7
2 changed files with 5 additions and 4 deletions
+3 -3
View File
@@ -37,8 +37,6 @@ void test_singularity(void)
{
logg("WARNING: Unable to read PID from file (cannot read PID from file).");
logg(" Cannot test if another FTL process is running!");
fclose(f);
exit(EXIT_FAILURE);
}
else
{
@@ -87,7 +85,7 @@ void go_daemon(void)
// Indication of fork() failure
if (process_id < 0)
{
printf("fork failed!\n");
logg("fork failed!\n");
// Return failure in exit status
exit(EXIT_FAILURE);
}
@@ -104,10 +102,12 @@ void go_daemon(void)
umask(0);
//set new session
// creates a session and sets the process group ID
sid = setsid();
if(sid < 0)
{
// Return failure
logg("setsid failed!\n");
exit(EXIT_FAILURE);
}
savepid(sid);
+2 -1
View File
@@ -14,13 +14,14 @@ volatile sig_atomic_t killed = 0;
static void SIGTERM_handler(int signum)
{
logg("\nFATAL: FTL received SIGTERM, sheduled to exit gracefully\n");
killed = 1;
}
static void SIGINT_handler(int signum)
{
// Should probably not use printf in signal handler, but this will anyhow exit immediately
printf("\nFATAL: FTL received SIGINT (Ctrl + C), exiting immediately!\n");
logg("\nFATAL: FTL received SIGINT (Ctrl + C), exiting immediately!\n");
exit(EXIT_FAILURE);
}