]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
main: rewrite some error messages
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 8 Mar 2017 09:14:35 +0000 (10:14 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 10 Mar 2017 15:51:03 +0000 (16:51 +0100)
main.c

diff --git a/main.c b/main.c
index c6ac8811cc5bb087f53e5717adac727b34962289..22fdd8935f2f89e7c59a6056ed5de36a8660a504 100644 (file)
--- a/main.c
+++ b/main.c
@@ -290,7 +290,7 @@ write_lockfile(void)
 
   out = fopen(pidfile, "w");
   if (!out) {
-    LOG_FATAL("could not open lockfile %s for writing", pidfile);
+    LOG_FATAL("Could not open %s : %s", pidfile, strerror(errno));
   } else {
     fprintf(out, "%d\n", (int)getpid());
     fclose(out);
@@ -307,14 +307,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_FATAL("Could not detach, pipe failed : %s", strerror(errno));
+    LOG_FATAL("pipe() failed : %s", strerror(errno));
   }
 
   /* Does this preserve existing signal handlers? */
   pid = fork();
 
   if (pid < 0) {
-    LOG_FATAL("Could not detach, fork failed : %s", strerror(errno));
+    LOG_FATAL("fork() failed : %s", strerror(errno));
   } else if (pid > 0) {
     /* In the 'grandparent' */
     char message[1024];
@@ -340,7 +340,7 @@ go_daemon(void)
     pid = fork();
 
     if (pid < 0) {
-      LOG_FATAL("Could not detach, fork failed : %s", strerror(errno));
+      LOG_FATAL("fork() failed : %s", strerror(errno));
     } else if (pid > 0) {
       exit(0); /* In the 'parent' */
     } else {
@@ -348,7 +348,7 @@ go_daemon(void)
 
       /* Change current directory to / */
       if (chdir("/") < 0) {
-        LOG_FATAL("Could not chdir to / : %s", strerror(errno));
+        LOG_FATAL("chdir() failed : %s", strerror(errno));
       }
 
       /* Don't keep stdin/out/err from before. But don't close