mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-17 01:54:49 +00:00
logging - fix for clear single log target keeps clog file, closes https://github.com/opnsense/core/issues/5644
This commit is contained in:
parent
8db4f8c72d
commit
fcbca64262
@ -49,7 +49,6 @@ if (isset($opts['m']) && isset($opts['f'])) {
|
||||
} else {
|
||||
$basename = "/var/log/{$mname}/{$fname}";
|
||||
}
|
||||
$filename = "{$basename}.log";
|
||||
|
||||
if (is_dir($basename)) {
|
||||
foreach (glob("{$basename}/{$fname}_*.log") as $filename) {
|
||||
@ -58,17 +57,10 @@ if (isset($opts['m']) && isset($opts['f'])) {
|
||||
system_syslog_start();
|
||||
}
|
||||
|
||||
$filename = "{$basename}.log";
|
||||
if (is_file($filename)) {
|
||||
/* preserve file ownership and permissions
|
||||
XXX: not sure if this is still needed, at least it's not consistent with how directories are reset now.
|
||||
*/
|
||||
if (file_exists($filename)) {
|
||||
$handle = fopen($filename, 'r+');
|
||||
if ($handle) {
|
||||
ftruncate($handle, 0);
|
||||
fclose($handle);
|
||||
}
|
||||
}
|
||||
// remove legacy clog file
|
||||
@unlink($filename);
|
||||
system_syslog_start();
|
||||
// XXX: should probably add some plugin hook for this.
|
||||
if ($fname == 'dhcpd' && $mname == 'core') {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user