]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Fix compiler warnings
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 27 Feb 2012 15:08:14 +0000 (16:08 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 27 Feb 2012 15:08:21 +0000 (16:08 +0100)
logging.c
main.c

index 25378e81b472a47a730ec3a2dcad78ea95da5812..04f9f596a49b8893488bfaf4ab2de50d00ae2de4 100644 (file)
--- a/logging.c
+++ b/logging.c
@@ -157,7 +157,8 @@ LOG_Fatal_Function(LOG_Facility facility, const char *format, ...)
     fprintf(stderr, "Fatal error : %s\n", buf);
   }
   if (parent_fd) {
-    write(parent_fd, buf, strlen(buf) + 1);
+    if (write(parent_fd, buf, strlen(buf) + 1) < 0)
+      ; /* Not much we can do here */
   }
 #endif
 
diff --git a/main.c b/main.c
index 3bf02aac6c9167f8696fdf9d1c69af6b5fc65241..ee8064c6546291224dad0d2472b230b46ae29398 100644 (file)
--- a/main.c
+++ b/main.c
@@ -259,6 +259,11 @@ go_daemon(void)
     } else {
       /* In the child we want to leave running as the daemon */
 
+      /* Change current directory to / */
+      if (chdir("/") < 0) {
+        LOG(LOGS_ERR, LOGF_Logging, "Could not chdir to / : %s", strerror(errno));
+      }
+
       /* Don't keep stdin/out/err from before. But don't close
          the parent pipe yet. */
       for (fd=0; fd<1024; fd++) {
@@ -266,9 +271,6 @@ go_daemon(void)
           close(fd);
       }
 
-      /* Change current directory to / */
-      chdir("/");
-
       LOG_SetParentFd(pipefd[1]);
     }
   }