mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
Increase verbosity and don't exit if PID file cannot be read
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user