Move the -s (nosignal) processing, as newsyslog needs to print out a
warning message if -s is specified and it rotates a file that expects to be compressed. This warning message is not printed if -R is also specified, because we assume a -sR request is coming from the process which would have been signaled, and that it has already released the logfile. Indirectly noticed by: sheldonh
This commit is contained in:
parent
9722121a3c
commit
40fe458d04
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=111966
@ -874,16 +874,6 @@ parse_file(FILE *cf, const char *cfname, struct conf_entry **work_p,
|
||||
free(working->pid_file);
|
||||
working->pid_file = NULL;
|
||||
}
|
||||
} else if (nosignal) {
|
||||
/*
|
||||
* While this entry might usually signal some
|
||||
* process via the pid-file, newsyslog was run
|
||||
* with '-s', so quietly ignore the pid-file.
|
||||
*/
|
||||
if (working->pid_file != NULL) {
|
||||
free(working->pid_file);
|
||||
working->pid_file = NULL;
|
||||
}
|
||||
} else if (working->pid_file == NULL) {
|
||||
/*
|
||||
* This entry did not specify the 'n' flag, which
|
||||
@ -1071,11 +1061,24 @@ dotrim(const struct conf_entry *ent, char *log, int numdays, int flags)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Find out if there is a process to signal. If nosignal (-s) was
|
||||
* specified, then do not signal any process. Note that nosignal
|
||||
* will trigger a warning message if the rotated logfile needs to
|
||||
* be compressed, *unless* -R was specified. This is because there
|
||||
* presumably still are process(es) writing to the old logfile, but
|
||||
* we assume that a -sR request comes from a process which writes
|
||||
* to the logfile, and as such, that process has already made sure
|
||||
* that the logfile is not presently in use.
|
||||
*/
|
||||
pid = 0;
|
||||
need_notification = notified = 0;
|
||||
if (ent->pid_file != NULL) {
|
||||
need_notification = 1;
|
||||
pid = get_pid(ent->pid_file);
|
||||
if (!nosignal)
|
||||
pid = get_pid(ent->pid_file); /* the normal case! */
|
||||
else if (rotatereq)
|
||||
need_notification = 0;
|
||||
}
|
||||
if (pid) {
|
||||
if (noaction) {
|
||||
|
Loading…
Reference in New Issue
Block a user