The -r option of newsyslog(8) removes the requirement
that newsyslog runs as root. Would it also make sense
to not try to send the SIGHUP to syslogd in that case?

        Jan


Index: newsyslog.8
===================================================================
RCS file: /cvs/src/usr.bin/newsyslog/newsyslog.8,v
retrieving revision 1.52
diff -u -p -u -p -r1.52 newsyslog.8
--- newsyslog.8 16 Sep 2014 16:27:23 -0000      1.52
+++ newsyslog.8 12 Nov 2015 21:20:52 -0000
@@ -123,7 +123,7 @@ Removes the restriction that
 must be running as root.
 Note that in this mode
 .Nm
-will not be able to send a
+will not try to send a
 .Dv SIGHUP
 signal to
 .Xr syslogd 8 .
Index: newsyslog.c
===================================================================
RCS file: /cvs/src/usr.bin/newsyslog/newsyslog.c,v
retrieving revision 1.95
diff -u -p -u -p -r1.95 newsyslog.c
--- newsyslog.c 20 Aug 2015 22:32:41 -0000      1.95
+++ newsyslog.c 12 Nov 2015 21:20:52 -0000
@@ -406,7 +406,7 @@ send_signal(char *pidfile, int signal)
                warnx("%s pid file: %s", err, pidfile);
        else if (noaction)
                (void)printf("kill -%s %ld\n", sys_signame[signal], (long)pid);
-       else if (kill(pid, signal))
+       else if (needroot && kill(pid, signal))
                warnx("warning - could not send SIG%s to PID from pid file %s",
                    sys_signame[signal], pidfile);
 }

Reply via email to