summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-09-19 20:58:51 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-09-19 20:58:51 +0000
commit14a835fb3de78f0aaf204e58c4adebf477170b29 (patch)
tree2a2b29948a5902b12f775849375f21b6858ee59b
parent0301ecfcf510c0dc7ce9d8b07c2d4a860f2a552b (diff)
Fix long-standing bug. When specifying a command to run instead of sending
a signal, the command was never actually run.
-rw-r--r--usr.bin/newsyslog/newsyslog.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/newsyslog/newsyslog.c b/usr.bin/newsyslog/newsyslog.c
index 2d20dec2e0c..5dca3e45b34 100644
--- a/usr.bin/newsyslog/newsyslog.c
+++ b/usr.bin/newsyslog/newsyslog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: newsyslog.c,v 1.54 2002/09/19 15:27:31 millert Exp $ */
+/* $OpenBSD: newsyslog.c,v 1.55 2002/09/19 20:58:50 millert Exp $ */
/*
* Copyright (c) 1999, 2002 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -86,7 +86,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: newsyslog.c,v 1.54 2002/09/19 15:27:31 millert Exp $";
+static const char rcsid[] = "$OpenBSD: newsyslog.c,v 1.55 2002/09/19 20:58:50 millert Exp $";
#endif /* not lint */
#ifndef CONF
@@ -248,8 +248,10 @@ main(int argc, char **argv)
struct pidinfo *pltmp;
for (pltmp = pidlist; pltmp < pl; pltmp++) {
- if ((strcmp(pltmp->file, q->pidfile) == 0 &&
- pltmp->signal == q->signal) || (q->runcmd &&
+ if ((q->pidfile &&
+ strcmp(pltmp->file, q->pidfile) == 0 &&
+ pltmp->signal == q->signal) ||
+ (q->runcmd &&
strcmp(q->runcmd, pltmp->file) == 0))
break;
}
@@ -345,7 +347,7 @@ void
run_command(char *cmd)
{
if (noaction)
- (void)printf("\trun %s\n", cmd);
+ (void)printf("run %s\n", cmd);
else
system(cmd);
}
@@ -619,6 +621,8 @@ parse_file(int *nentries)
working->runcmd = strdup(++q);
if (working->runcmd == NULL)
err(1, "strdup");
+ working->pidfile = NULL;
+ working->signal = -1;
} else if (strncmp(q, "SIG", 3) == 0) {
int i;