summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/newsyslog/newsyslog.87
-rw-r--r--usr.bin/newsyslog/newsyslog.c22
2 files changed, 19 insertions, 10 deletions
diff --git a/usr.bin/newsyslog/newsyslog.8 b/usr.bin/newsyslog/newsyslog.8
index 46a4226af2c..4a1a5c17f09 100644
--- a/usr.bin/newsyslog/newsyslog.8
+++ b/usr.bin/newsyslog/newsyslog.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: newsyslog.8,v 1.28 2002/09/17 20:44:38 millert Exp $
+.\" $OpenBSD: newsyslog.8,v 1.29 2002/09/19 21:22:59 millert Exp $
.\"
.\" Copyright (c) 1997, Jason Downs. All rights reserved.
.\"
@@ -266,6 +266,11 @@ and be the signal name, not the number, e.g.,
Specify a command to run instead of sending a signal to the process.
The command must be enclosed in double quotes
.Pq Ql \&" ) .
+The empty string,
+.Ql \&"\&" ,
+can use used to prevent
+.Nm
+from sending a signal or running a command.
You cannot specify both a command and a PID file.
.Em NOTE:
If you specify a command to be run,
diff --git a/usr.bin/newsyslog/newsyslog.c b/usr.bin/newsyslog/newsyslog.c
index 5dca3e45b34..2caf3d604fd 100644
--- a/usr.bin/newsyslog/newsyslog.c
+++ b/usr.bin/newsyslog/newsyslog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: newsyslog.c,v 1.55 2002/09/19 20:58:50 millert Exp $ */
+/* $OpenBSD: newsyslog.c,v 1.56 2002/09/19 21:22:59 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.55 2002/09/19 20:58:50 millert Exp $";
+static const char rcsid[] = "$OpenBSD: newsyslog.c,v 1.56 2002/09/19 21:22:59 millert Exp $";
#endif /* not lint */
#ifndef CONF
@@ -271,10 +271,12 @@ main(int argc, char **argv)
/* Step 3, send a signal or run a command */
for (pl = pidlist; pl->file; pl++) {
- if (pl->signal == -1)
- run_command(pl->file);
- else
- send_signal(pl->file, pl->signal);
+ if (pl->file != NULL) {
+ if (pl->signal == -1)
+ run_command(pl->file);
+ else
+ send_signal(pl->file, pl->signal);
+ }
}
if (!noaction)
sleep(5);
@@ -618,9 +620,11 @@ parse_file(int *nentries)
err(1, "strdup");
} else if (*q == '"' && (tmp = strchr(q + 1, '"'))) {
*(parse = tmp) = '\0';
- working->runcmd = strdup(++q);
- if (working->runcmd == NULL)
- err(1, "strdup");
+ if (*++q != '\0') {
+ working->runcmd = strdup(q);
+ if (working->runcmd == NULL)
+ err(1, "strdup");
+ }
working->pidfile = NULL;
working->signal = -1;
} else if (strncmp(q, "SIG", 3) == 0) {