journald: before closing /dev/kmsg let's unregister the event source
authorLennart Poettering <lennart@poettering.net>
Tue, 17 Dec 2013 19:02:21 +0000 (20:02 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 17 Dec 2013 19:02:21 +0000 (20:02 +0100)
src/journal/journald-kmsg.c

index 5c7c06a..0c8446a 100644 (file)
@@ -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;
 }