summaryrefslogtreecommitdiffstats
path: root/usr.sbin/newsyslog/newsyslog.c
diff options
context:
space:
mode:
authormarkj <markj@FreeBSD.org>2013-01-27 06:01:35 +0000
committermarkj <markj@FreeBSD.org>2013-01-27 06:01:35 +0000
commiteb5455fa48e6e07315efde38fa7c532224892515 (patch)
treeb7ddec8e11ad4917e00f1e4ecf6443a39dc4940f /usr.sbin/newsyslog/newsyslog.c
parent9d3fe418801a25c3c0be6e919a641d3f2a35e512 (diff)
downloadFreeBSD-src-eb5455fa48e6e07315efde38fa7c532224892515.zip
FreeBSD-src-eb5455fa48e6e07315efde38fa7c532224892515.tar.gz
When the 'R' flag is used with a newsyslog.conf entry, some fields of
the corresponding struct sigwork_entry were left uninitialized, potentially causing an early return from do_sigwork(). Ensure that these fields are initialized, and handle the 'R' flag properly in do_sigwork(). PR: bin/175330 Reviewed by: gad Approved by: rstone (co-mentor) MFC after: 1 week
Diffstat (limited to 'usr.sbin/newsyslog/newsyslog.c')
-rw-r--r--usr.sbin/newsyslog/newsyslog.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c
index 42cc013..2bfdfd1 100644
--- a/usr.sbin/newsyslog/newsyslog.c
+++ b/usr.sbin/newsyslog/newsyslog.c
@@ -1866,7 +1866,7 @@ do_sigwork(struct sigwork_entry *swork)
int kres, secs;
char *tmp;
- if (!(swork->sw_pidok) || swork->sw_pid == 0)
+ if (swork->run_cmd == 0 && (!(swork->sw_pidok) || swork->sw_pid == 0))
return; /* no work to do... */
/*
@@ -2078,6 +2078,8 @@ save_sigwork(const struct conf_entry *ent)
stmp->run_cmd = 0;
/* If this is a command to run we just set the flag and run command */
if (ent->flags & CE_PID2CMD) {
+ stmp->sw_pid = -1;
+ stmp->sw_pidok = 0;
stmp->run_cmd = 1;
} else {
set_swpid(stmp, ent);
OpenPOWER on IntegriCloud