]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sys_linux: improve error message for failed PHC open 4.8
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 27 Aug 2025 10:22:48 +0000 (12:22 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 27 Aug 2025 12:05:31 +0000 (14:05 +0200)
If the specified PHC device cannot be opened directly, an attempt is
made to open it as a network interface. When that fails, the error
"Could not open PHC of iface" is misleading the user that it was handled
only as an interface. Change the message to "Could not open PHC (of)" to
better cover both possibilities. Also remove the errno as it's not set
in all code paths.

sys_linux.c

index 53c49a89214ed61e0965645ba00c1f98aa052fb6..ca5540f2b54885ba2cb34875498b20a7c48e2e37 100644 (file)
@@ -944,8 +944,7 @@ SYS_Linux_OpenPHC(const char *device, int flags)
   if (phc_fd < 0) {
     phc_fd = open_phc_by_iface_name(device, flags);
     if (phc_fd < 0) {
-      LOG(LOGS_ERR, "Could not open PHC of iface %s : %s",
-          device, strerror(errno));
+      LOG(LOGS_ERR, "Could not open PHC (of) %s", device);
       return -1;
     }
     phc_fd = verify_fd_is_phc(phc_fd);