]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
refclock: improve error messages
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 9 Aug 2018 11:56:56 +0000 (13:56 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 9 Aug 2018 12:52:08 +0000 (14:52 +0200)
refclock_pps.c
refclock_shm.c
refclock_sock.c

index 6f0565ee6596e31a5e3b0d6bf4f8144eab773bb6..f72e80f4e41c9393b0854ac38ed0cf130cbacdfe 100644 (file)
@@ -59,24 +59,24 @@ static int pps_initialise(RCL_Instance instance) {
 
   fd = open(path, O_RDWR);
   if (fd < 0) {
-    LOG_FATAL("open() failed on %s", path);
+    LOG_FATAL("Could not open %s : %s", path, strerror(errno));
     return 0;
   }
 
   UTI_FdSetCloexec(fd);
 
   if (time_pps_create(fd, &handle) < 0) {
-    LOG_FATAL("time_pps_create() failed on %s", path);
+    LOG_FATAL("time_pps_create() failed on %s : %s", path, strerror(errno));
     return 0;
   }
 
   if (time_pps_getcap(handle, &mode) < 0) {
-    LOG_FATAL("time_pps_getcap() failed on %s", path);
+    LOG_FATAL("time_pps_getcap() failed on %s : %s", path, strerror(errno));
     return 0;
   }
 
   if (time_pps_getparams(handle, &params) < 0) {
-    LOG_FATAL("time_pps_getparams() failed on %s", path);
+    LOG_FATAL("time_pps_getparams() failed on %s : %s", path, strerror(errno));
     return 0;
   }
 
@@ -97,7 +97,7 @@ static int pps_initialise(RCL_Instance instance) {
   }
 
   if (time_pps_setparams(handle, &params) < 0) {
-    LOG_FATAL("time_pps_setparams() failed on %s", path);
+    LOG_FATAL("time_pps_setparams() failed on %s : %s", path, strerror(errno));
     return 0;
   }
 
index 7cced1d5d5991a6a4c0072ac03417a998e1c7610..e8f62560b48e66e8dfa8a50898de573045ecefab 100644 (file)
@@ -69,13 +69,13 @@ static int shm_initialise(RCL_Instance instance) {
 
   id = shmget(SHMKEY + param, sizeof (struct shmTime), IPC_CREAT | perm);
   if (id == -1) {
-    LOG_FATAL("shmget() failed");
+    LOG_FATAL("shmget() failed : %s", strerror(errno));
     return 0;
   }
    
   shm = (struct shmTime *)shmat(id, 0, 0);
   if ((long)shm == -1) {
-    LOG_FATAL("shmat() failed");
+    LOG_FATAL("shmat() failed : %s", strerror(errno));
     return 0;
   }
 
index 4e8f2b222de4675457470afd993f0f548aeda9c8..176310ca179de74a8cd3f8fa8c03bb8da6643c7c 100644 (file)
@@ -105,7 +105,7 @@ static int sock_initialise(RCL_Instance instance)
  
   s.sun_family = AF_UNIX;
   if (snprintf(s.sun_path, sizeof (s.sun_path), "%s", path) >= sizeof (s.sun_path)) {
-    LOG_FATAL("path %s is too long", path);
+    LOG_FATAL("Path %s too long", path);
     return 0;
   }
 
@@ -119,7 +119,7 @@ static int sock_initialise(RCL_Instance instance)
 
   unlink(path);
   if (bind(sockfd, (struct sockaddr *)&s, sizeof (s)) < 0) {
-    LOG_FATAL("bind() failed");
+    LOG_FATAL("bind(%s) failed : %s", path, strerror(errno));
     return 0;
   }