Lines 34-39
Link Here
|
34 |
#include <stdio.h> |
34 |
#include <stdio.h> |
35 |
#include <stdlib.h> |
35 |
#include <stdlib.h> |
36 |
#include <string.h> |
36 |
#include <string.h> |
|
|
37 |
#include <time.h> |
37 |
#include <unistd.h> |
38 |
#include <unistd.h> |
38 |
|
39 |
|
39 |
#include "ntpd.h" |
40 |
#include "ntpd.h" |
Lines 95-100
Link Here
|
95 |
int ch, nfds, timeout = INFTIM; |
96 |
int ch, nfds, timeout = INFTIM; |
96 |
int pipe_chld[2]; |
97 |
int pipe_chld[2]; |
97 |
extern char *__progname; |
98 |
extern char *__progname; |
|
|
99 |
time_t start_time; |
98 |
|
100 |
|
99 |
__progname = _compat_get_progname(argv[0]); |
101 |
__progname = _compat_get_progname(argv[0]); |
100 |
|
102 |
|
Lines 197-202
Link Here
|
197 |
fatal(NULL); |
199 |
fatal(NULL); |
198 |
imsg_init(ibuf, pipe_chld[0]); |
200 |
imsg_init(ibuf, pipe_chld[0]); |
199 |
|
201 |
|
|
|
202 |
start_time = getmonotime(); |
203 |
|
200 |
while (quit == 0) { |
204 |
while (quit == 0) { |
201 |
pfd[PFD_PIPE].fd = ibuf->fd; |
205 |
pfd[PFD_PIPE].fd = ibuf->fd; |
202 |
pfd[PFD_PIPE].events = POLLIN; |
206 |
pfd[PFD_PIPE].events = POLLIN; |
Lines 209-219
Link Here
|
209 |
quit = 1; |
213 |
quit = 1; |
210 |
} |
214 |
} |
211 |
|
215 |
|
212 |
if (nfds == 0 && lconf.settime) { |
216 |
if (lconf.settime && |
|
|
217 |
(nfds == 0 || getmonotime() > start_time+SETTIME_TIMEOUT)) { |
213 |
lconf.settime = 0; |
218 |
lconf.settime = 0; |
214 |
timeout = INFTIM; |
219 |
timeout = INFTIM; |
215 |
log_init(lconf.debug); |
220 |
log_init(lconf.debug); |
216 |
log_debug("no reply received in time, skipping initial " |
221 |
log_warnx("no reply received in time, skipping initial " |
217 |
"time setting"); |
222 |
"time setting"); |
218 |
if (!lconf.debug) { |
223 |
if (!lconf.debug) { |
219 |
if (daemon(1, 0)) |
224 |
if (daemon(1, 0)) |