]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
main: switch errors in initialization to fatal errors
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 30 Apr 2014 14:27:53 +0000 (16:27 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 30 Apr 2014 16:47:53 +0000 (18:47 +0200)
main.c

diff --git a/main.c b/main.c
index acaaf0d15ff972e7e89927cfc8e1b23c9dc4c0eb..657ed8ae1d65de7451adcf0ec2b29234a166f798 100644 (file)
--- 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