aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-03-27 13:37:40 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2019-03-27 13:47:38 +0100
commitda996c5d2ace026506eb82d3b04ac48bb7aca3fb (patch)
tree4f184b2e221dff6255123db8fc7f84285095d1b5
parent4d1c5149a09722cd6dcf718812a347db60110706 (diff)
downloadbusybox-w32-da996c5d2ace026506eb82d3b04ac48bb7aca3fb.tar.gz
busybox-w32-da996c5d2ace026506eb82d3b04ac48bb7aca3fb.tar.bz2
busybox-w32-da996c5d2ace026506eb82d3b04ac48bb7aca3fb.zip
ntpd: do not create pid file if not backgrounded
function old new delta ntp_init 995 1021 +26 ntpd_main 1267 1257 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 26/-10) Total: 16 bytes Reported by Alfonso Ranieri <alforan@tin.it> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/ntpd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/networking/ntpd.c b/networking/ntpd.c
index b2e77929e..027cfe783 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -2585,6 +2585,10 @@ static NOINLINE void ntp_init(char **argv)
2585 /* -l but no peers: "stratum 1 server" mode */ 2585 /* -l but no peers: "stratum 1 server" mode */
2586 G.stratum = 1; 2586 G.stratum = 1;
2587 } 2587 }
2588
2589 if (!(opts & OPT_n)) /* only if backgrounded: */
2590 write_pidfile_std_path_and_ext("ntpd");
2591
2588 /* If network is up, syncronization occurs in ~10 seconds. 2592 /* If network is up, syncronization occurs in ~10 seconds.
2589 * We give "ntpd -q" 10 seconds to get first reply, 2593 * We give "ntpd -q" 10 seconds to get first reply,
2590 * then another 50 seconds to finish syncing. 2594 * then another 50 seconds to finish syncing.
@@ -2641,8 +2645,6 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv)
2641 */ 2645 */
2642 cnt = G.peer_cnt * (INITIAL_SAMPLES + 1); 2646 cnt = G.peer_cnt * (INITIAL_SAMPLES + 1);
2643 2647
2644 write_pidfile_std_path_and_ext("ntpd");
2645
2646 while (!bb_got_signal) { 2648 while (!bb_got_signal) {
2647 llist_t *item; 2649 llist_t *item;
2648 unsigned i, j; 2650 unsigned i, j;