From fe35de6931771908233d3b4b0bb3d2b8b4a4ba73 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Wed, 30 Apr 2014 16:27:53 +0200 Subject: [PATCH] main: switch errors in initialization to fatal errors --- main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index acaaf0d..657ed8a 100644 --- a/main.c +++ b/main.c @@ -255,7 +255,7 @@ write_lockfile(void) out = fopen(pidfile, "w"); if (!out) { - LOG(LOGS_ERR, LOGF_Main, "could not open lockfile %s for writing", pidfile); + LOG_FATAL(LOGF_Main, "could not open lockfile %s for writing", pidfile); } else { fprintf(out, "%d\n", getpid()); fclose(out); @@ -277,14 +277,14 @@ go_daemon(void) /* Create pipe which will the daemon use to notify the grandparent when it's initialised or send an error message */ if (pipe(pipefd)) { - LOG(LOGS_ERR, LOGF_Logging, "Could not detach, pipe failed : %s", strerror(errno)); + LOG_FATAL(LOGF_Logging, "Could not detach, pipe failed : %s", strerror(errno)); } /* Does this preserve existing signal handlers? */ pid = fork(); if (pid < 0) { - LOG(LOGS_ERR, LOGF_Logging, "Could not detach, fork failed : %s", strerror(errno)); + LOG_FATAL(LOGF_Logging, "Could not detach, fork failed : %s", strerror(errno)); } else if (pid > 0) { /* In the 'grandparent' */ char message[1024]; @@ -309,7 +309,7 @@ go_daemon(void) pid = fork(); if (pid < 0) { - LOG(LOGS_ERR, LOGF_Logging, "Could not detach, fork failed : %s", strerror(errno)); + LOG_FATAL(LOGF_Logging, "Could not detach, fork failed : %s", strerror(errno)); } else if (pid > 0) { exit(0); /* In the 'parent' */ } else { @@ -317,7 +317,7 @@ go_daemon(void) /* Change current directory to / */ if (chdir("/") < 0) { - LOG(LOGS_ERR, LOGF_Logging, "Could not chdir to / : %s", strerror(errno)); + LOG_FATAL(LOGF_Logging, "Could not chdir to / : %s", strerror(errno)); } /* Don't keep stdin/out/err from before. But don't close