system: closelog() -> syslog() trashes our main openlog()

So do a "reopenlog()" in the most convenient way (which is not very
convenient).  Noticed while working on #6115
This commit is contained in:
Franco Fichtner 2022-11-04 12:20:53 +01:00
parent add531ec82
commit ef11b7fc1f
6 changed files with 13 additions and 4 deletions

View File

@ -132,6 +132,7 @@ function session_auth()
openlog("audit", LOG_ODELAY, LOG_AUTH);
log_msg($message, $prio);
closelog();
reopenlog();
}
if (session_status() == PHP_SESSION_NONE) {

View File

@ -71,7 +71,13 @@ final class product
}
}
openlog(product::getInstance()->id(), LOG_ODELAY, LOG_USER);
function reopenlog()
{
openlog(product::getInstance()->id(), LOG_ODELAY, LOG_USER);
}
reopenlog();
register_shutdown_function('closelog');
require_once("xmlparse.inc");

View File

@ -296,6 +296,7 @@ function filter_configure_sync($verbose = false, $load_aliases = true)
unlock($filterlck);
closelog();
reopenlog();
service_log("done.\n", $verbose);
@ -394,6 +395,7 @@ function filter_configure_sync($verbose = false, $load_aliases = true)
unlock($filterlck);
closelog();
reopenlog();
service_log("failed.\n", $verbose);
@ -435,6 +437,7 @@ function filter_configure_sync($verbose = false, $load_aliases = true)
unlock($filterlck);
closelog();
reopenlog();
service_log("failed.\n", $verbose);
@ -468,6 +471,7 @@ function filter_configure_sync($verbose = false, $load_aliases = true)
unlock($filterlck);
closelog();
reopenlog();
service_log("done.\n", $verbose);
}

View File

@ -557,6 +557,7 @@ function unbound_add_host_entries($ifconfig_details = null)
file_put_contents('/var/unbound/host_entries.conf', $unbound_entries);
closelog();
reopenlog();
}
function unbound_acls_subnets()

View File

@ -77,5 +77,4 @@ if (!empty($auth_data['user']) && isset($auth_data['password'])) {
}
}
closelog();
exit($exit_status);

View File

@ -56,12 +56,10 @@ if (flock($fp, LOCK_EX)) {
SRV_FAIL_FACTOR, implode(",", $failed_services)
));
set_single_sysctl("net.inet.carp.demotion", SRV_FAIL_FACTOR);
closelog();
} elseif (empty($failed_services) && $demotion_set) {
// demotion bitmask set and service(s) operational
syslog(LOG_WARNING, sprintf("carp promoted by %d due to service recovery", SRV_FAIL_FACTOR));
set_single_sysctl("net.inet.carp.demotion", -1 * SRV_FAIL_FACTOR);
closelog();
}
flock($fp, LOCK_UN);