From 20e099544f60c578f5e39300f250eb9032b0e816 Mon Sep 17 00:00:00 2001 From: vangyzen Date: Wed, 15 Jun 2016 14:11:49 +0000 Subject: [PATCH] MFC r301532 newsyslog: Eliminate unnecessary sleep(10) when -R and -s are specified After going through the signal work list, during which do_sigwork() is called and essentially does nothing because -s and -R were specified on the command line, newsyslog will sleep for 10 seconds as the (verbose) code says: "Pause 10 seconds to allow daemon(s) to close log file(s)". However, the man page verbiage for -R (and -s) seems quite clear that this sleep() is unnecessary because the daemon was expected to have already closed the log file before calling newsyslog. PR: 210020 Submitted by: David A. Bright Sponsored by: Dell Inc. git-svn-id: svn://svn.freebsd.org/base/stable/10@301926 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- usr.sbin/newsyslog/newsyslog.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c index f405bf898..34dd5218e 100644 --- a/usr.sbin/newsyslog/newsyslog.c +++ b/usr.sbin/newsyslog/newsyslog.c @@ -333,13 +333,15 @@ main(int argc, char **argv) printf("Signal all daemon process(es)...\n"); SLIST_FOREACH(stmp, &swhead, sw_nextp) do_sigwork(stmp); - if (noaction) - printf("\tsleep 10\n"); - else { - if (verbose) - printf("Pause 10 seconds to allow daemon(s)" - " to close log file(s)\n"); - sleep(10); + if (!(rotatereq && nosignal)) { + if (noaction) + printf("\tsleep 10\n"); + else { + if (verbose) + printf("Pause 10 seconds to allow " + "daemon(s) to close log file(s)\n"); + sleep(10); + } } } /* -- 2.45.0