summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-12 05:01:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-12 05:01:23 +0000
commita05990c6c7250ba0aaed94e0222b598e0190bad4 (patch)
treec3661f2aea2badd5ef62949469ccb98935c8e20b /main.c
parentAdding debian version 4.5-3. (diff)
downloadchrony-a05990c6c7250ba0aaed94e0222b598e0190bad4.tar.xz
chrony-a05990c6c7250ba0aaed94e0222b598e0190bad4.zip
Merging upstream version 4.6.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'main.c')
-rw-r--r--main.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/main.c b/main.c
index 21d0fe7..88ada20 100644
--- a/main.c
+++ b/main.c
@@ -32,6 +32,7 @@
#include "main.h"
#include "sched.h"
+#include "leapdb.h"
#include "local.h"
#include "sys.h"
#include "ntp_io.h"
@@ -134,6 +135,7 @@ MAI_CleanupAndExit(void)
RCL_Finalise();
SRC_Finalise();
REF_Finalise();
+ LDB_Finalise();
RTC_Finalise();
SYS_Finalise();
@@ -213,7 +215,10 @@ post_init_ntp_hook(void *anything)
REF_SetMode(ref_mode);
}
- /* Close the pipe to the foreground process so it can exit */
+ /* Send an empty message to the foreground process so it can exit.
+ If that fails, indicating the process was killed, exit too. */
+ if (!LOG_NotifyParent(""))
+ SCH_QuitProgram();
LOG_CloseParentFd();
CNF_AddSources();
@@ -336,8 +341,8 @@ go_daemon(void)
close(pipefd[1]);
r = read(pipefd[0], message, sizeof (message));
- if (r) {
- if (r > 0) {
+ if (r != 1 || message[0] != '\0') {
+ if (r > 1) {
/* Print the error message from the child */
message[sizeof (message) - 1] = '\0';
fprintf(stderr, "%s\n", message);
@@ -655,6 +660,7 @@ int main
if (!geteuid())
LOG(LOGS_WARN, "Running with root privileges");
+ LDB_Initialise();
REF_Initialise();
SST_Initialise();
NSR_Initialise();