[systemd-commits] 2 commits - src/journal
Lennart Poettering
lennart at kemper.freedesktop.org
Tue Dec 17 10:57:54 PST 2013
src/journal/journald-kmsg.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
New commits:
commit c0f71f469fef3f3a0822e0021085e6d165df2b46
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Dec 17 19:57:13 2013 +0100
journald: close /dev/kmsg again if we cannot make use of it
diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c
index 1730a23..5c7c06a 100644
--- a/src/journal/journald-kmsg.c
+++ b/src/journal/journald-kmsg.c
@@ -408,22 +408,30 @@ int server_open_dev_kmsg(Server *s) {
/* This will fail with EPERM on older kernels where
* /dev/kmsg is not readable. */
- if (r == -EPERM)
- return 0;
+ if (r == -EPERM) {
+ r = 0;
+ goto fail;
+ }
log_error("Failed to add /dev/kmsg fd to event loop: %s", strerror(-r));
- return -errno;
+ goto fail;
}
r = sd_event_source_set_priority(s->dev_kmsg_event_source, SD_EVENT_PRIORITY_IMPORTANT+10);
if (r < 0) {
log_error("Failed to adjust priority of kmsg event source: %s", strerror(-r));
- return -errno;
+ goto fail;
}
s->dev_kmsg_readable = true;
return 0;
+
+fail:
+ close_nointr_nofail(s->dev_kmsg_fd);
+ s->dev_kmsg_fd = -1;
+
+ return r;
}
int server_open_kernel_seqnum(Server *s) {
commit 445ea9be520b9549aee45d0b6427cf48b446987f
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Dec 17 19:56:06 2013 +0100
journald: downgrade warning message when /dev/kmsg does not exist
diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c
index bc42548..1730a23 100644
--- a/src/journal/journald-kmsg.c
+++ b/src/journal/journald-kmsg.c
@@ -398,7 +398,8 @@ int server_open_dev_kmsg(Server *s) {
s->dev_kmsg_fd = open("/dev/kmsg", O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
if (s->dev_kmsg_fd < 0) {
- log_warning("Failed to open /dev/kmsg, ignoring: %m");
+ log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
+ "Failed to open /dev/kmsg, ignoring: %m");
return 0;
}
More information about the systemd-commits
mailing list