]>
Commit | Line | Data |
---|---|---|
6f300951 | 1 | /* IPFire helper program - restartntpd |
91dc1bfc MT |
2 | * |
3 | * Starts or stops the ntpd daemon | |
91dc1bfc MT |
4 | * |
5 | */ | |
6 | ||
7 | #include <stdio.h> | |
8 | #include <string.h> | |
9 | #include <unistd.h> | |
10 | #include <stdlib.h> | |
11 | #include <sys/types.h> | |
12 | #include <fcntl.h> | |
13 | #include "setuid.h" | |
14 | ||
15 | ||
16 | int main(void) | |
17 | { | |
18 | int fd = -1; | |
19 | int enable = 0; | |
20 | ||
21 | if (!(initsetuid())) | |
22 | exit(1); | |
23 | ||
6f300951 | 24 | safe_system("/etc/rc.d/init.d/ntp stop 2>&1 >/dev/null"); |
91dc1bfc MT |
25 | sleep(3); |
26 | ||
27 | if ((fd = open(CONFIG_ROOT "/time/allowclients", O_RDONLY)) != -1) | |
28 | { | |
29 | close(fd); | |
30 | enable = 1; | |
31 | } | |
32 | ||
33 | if (enable) | |
34 | { | |
6f300951 | 35 | safe_system("/etc/rc.d/init.d/ntp start 2>&1 >/dev/null"); |
91dc1bfc MT |
36 | } |
37 | return 0; | |
38 | } |