summaryrefslogtreecommitdiff
path: root/src/journal/journald-kmsg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/journal/journald-kmsg.c')
-rw-r--r--src/journal/journald-kmsg.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c
index 5c7c06a14a..0c8446a3d5 100644
--- a/src/journal/journald-kmsg.c
+++ b/src/journal/journald-kmsg.c
@@ -428,8 +428,13 @@ int server_open_dev_kmsg(Server *s) {
return 0;
fail:
- close_nointr_nofail(s->dev_kmsg_fd);
- s->dev_kmsg_fd = -1;
+ if (s->dev_kmsg_event_source)
+ s->dev_kmsg_event_source = sd_event_source_unref(s->dev_kmsg_event_source);
+
+ if (s->dev_kmsg_fd >= 0) {
+ close_nointr_nofail(s->dev_kmsg_fd);
+ s->dev_kmsg_fd = -1;
+ }
return r;
}