summaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-08 01:22:27 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-08 01:22:27 +0200
commitc9b80453525f2a1ec3c71f7b0f649f786ec9e8dd (patch)
tree58e95ef3570936bca39e6383f445abca3b2098a9 /log.c
parent0dae83f9ff5303082f150492d9fa2d6bff391480 (diff)
log: log when we fail to open logging target
Diffstat (limited to 'log.c')
-rw-r--r--log.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/log.c b/log.c
index a1ca5d0227..497433a8b0 100644
--- 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.");