upon receipt of a SIGHUP do nothing if the log file is not specified #268

This commit is contained in:
Jordi Sanfeliu 2020-09-07 09:47:16 +02:00
parent 80217b1420
commit 45de1df780
1 changed files with 8 additions and 6 deletions

View File

@ -75,12 +75,14 @@ sub HUP_handler {
logger("SIG$signal caught.");
# upon receiving SIGHUP a new logfile is opened
close(STDOUT);
close(STDERR);
open(STDOUT, ">> $config{log_file}") || logger("Can't write to LOG: $!");
open(STDERR, ">> $config{log_file}") || logger("Can't write to LOG: $!");
chmod(0600, $config{log_file});
logger("$myself: opening a new log file.");
if($config{log_file}) {
close(STDOUT);
close(STDERR);
open(STDOUT, ">> $config{log_file}") || logger("Can't write to LOG: $!");
open(STDERR, ">> $config{log_file}") || logger("Can't write to LOG: $!");
chmod(0600, $config{log_file});
logger("$myself: opening a new log file.");
}
# restart HTTP built-in
if(lc($config{httpd_builtin}->{enabled} || "") eq "y") {