summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
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();