]> err.no Git - systemd/commitdiff
log: log when we fail to open logging target
authorLennart Poettering <lennart@poettering.net>
Wed, 7 Apr 2010 23:22:27 +0000 (01:22 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 7 Apr 2010 23:22:27 +0000 (01:22 +0200)
log.c

diff --git a/log.c b/log.c
index a1ca5d02272176c14e190fb9401c8d5c2f99ac5a..497433a8b01751929dcbc06f42cf63aa152df9ef 100644 (file)
--- a/log.c
+++ b/log.c
@@ -58,8 +58,10 @@ int log_open_kmsg(void) {
         if (kmsg_fd >= 0)
                 return 0;
 
-        if ((kmsg_fd = open("/dev/kmsg", O_WRONLY|O_NOCTTY|O_CLOEXEC)) < 0)
+        if ((kmsg_fd = open("/dev/kmsg", O_WRONLY|O_NOCTTY|O_CLOEXEC)) < 0) {
+                log_info("Failed to open syslog for logging: %s", strerror(errno));
                 return -errno;
+        }
 
         log_info("Succesfully opened /dev/kmsg for logging.");
 
@@ -109,7 +111,9 @@ int log_open_syslog(void) {
         if (connect(syslog_fd, &sa.sa, sizeof(sa)) < 0) {
                 r = -errno;
                 log_close_syslog();
-                return -errno;
+
+                log_info("Failed to open syslog for logging: %s", strerror(-r));
+                return r;
         }
 
         log_info("Succesfully opened syslog for logging.");