summaryrefslogtreecommitdiffstats
path: root/usr.sbin/newsyslog
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2003-03-07 21:06:32 +0000
committergad <gad@FreeBSD.org>2003-03-07 21:06:32 +0000
commitb746208d78fdf4aefd26241eadd4179ab5d6de37 (patch)
tree161e6e9b7b2563d2bb39bf142a93a09cfa41bd3e /usr.sbin/newsyslog
parenta189180b833e50908e46518d8f5a58e5e8be7d84 (diff)
downloadFreeBSD-src-b746208d78fdf4aefd26241eadd4179ab5d6de37.zip
FreeBSD-src-b746208d78fdf4aefd26241eadd4179ab5d6de37.tar.gz
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
Diffstat (limited to 'usr.sbin/newsyslog')
-rw-r--r--usr.sbin/newsyslog/newsyslog.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c
index 32efff7..b5e3b41 100644
--- a/usr.sbin/newsyslog/newsyslog.c
+++ b/usr.sbin/newsyslog/newsyslog.c
@@ -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) {
OpenPOWER on IntegriCloud