Page MenuHomeFreeBSD

D3961.id9578.diff
No OneTemporary

D3961.id9578.diff

Index: head/usr.sbin/newsyslog/newsyslog.c
===================================================================
--- head/usr.sbin/newsyslog/newsyslog.c
+++ head/usr.sbin/newsyslog/newsyslog.c
@@ -278,6 +278,7 @@
static int log_trim(const char *logname, const struct conf_entry *log_ent);
static int age_old_log(const char *file);
static void savelog(char *from, char *to);
+static int signame_to_signum(const char *);
static void createdir(const struct conf_entry *ent, char *dirpart);
static void createlog(const struct conf_entry *ent);
@@ -1338,11 +1339,11 @@
if (q && *q) {
if (*q == '/')
working->pid_cmd_file = strdup(q);
- else if (isdigit(*q))
+ else if (isalnum(*q))
goto got_sig;
else
errx(1,
- "illegal pid file or signal number in config file:\n%s",
+ "illegal pid file or signal in config file:\n%s",
errline);
}
if (eol)
@@ -1354,13 +1355,16 @@
working->sig = SIGHUP;
if (q && *q) {
- if (isdigit(*q)) {
+ if (isalnum(*q)) {
got_sig:
- working->sig = atoi(q);
+ if (isdigit(*q))
+ working->sig = atoi(q);
+ else
+ working->sig = signame_to_signum(q);
} else {
err_sig:
errx(1,
- "illegal signal number in config file:\n%s",
+ "illegal signal in config file:\n%s",
errline);
}
if (working->sig < 1 || working->sig >= NSIG)
@@ -2469,6 +2473,20 @@
err(1, "can't fclose %s", from);
}
+static int
+signame_to_signum(const char *sig)
+{
+ int n;
+
+ if (strncasecmp(sig, "SIG", 3) == 0)
+ sig += 3;
+ for (n = 1; n < sys_nsig; n++) {
+ if (!strcasecmp(sys_signame[n], sig))
+ return (n);
+ }
+ return (-1);
+}
+
/* create one or more directory components of a path */
static void
createdir(const struct conf_entry *ent, char *dirpart)
Index: head/usr.sbin/newsyslog/newsyslog.conf.5
===================================================================
--- head/usr.sbin/newsyslog/newsyslog.conf.5
+++ head/usr.sbin/newsyslog/newsyslog.conf.5
@@ -337,7 +337,7 @@
.Cm U
flag was specified.
If this field is present, a
-.Ar signal_number
+.Ar signal
is sent to the process ID contained in this file.
If this field is not present and the
.Cm N
@@ -358,14 +358,23 @@
by the
.Xr newsyslog 8
after rotation instead of sending the signal out.
-.It Ar signal_number
-This optional field specifies the signal number that will be sent
-to the daemon process (or to all processes in a process group, if the
+.It Ar signal
+This optional field specifies the signal that will be sent to the daemon
+process (or to all processes in a process group, if the
.Cm U
flag was specified).
If this field is not present, then a
.Dv SIGHUP
signal will be sent.
+Signal names
+must start with
+.Dq SIG
+and be the signal name, e.g.,
+.Dv SIGUSR1 .
+Alternatively,
+.Ar signal
+can be the signal number, e.g., 30 for
+.Dv SIGUSR1 .
.El
.Sh EXAMPLES
The following is an example of the

File Metadata

Mime Type
text/plain
Expires
Tue, Jul 28, 5:35 PM (1 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35668485
Default Alt Text
D3961.id9578.diff (2 KB)

Event Timeline