chiark / gitweb /
event: be more conservative when returning errors from event handler callbacks
[elogind.git] / src / network / networkd-manager.c
index d59b913..1b5837e 100644 (file)
@@ -22,6 +22,7 @@
 #include "path-util.h"
 #include "networkd.h"
 #include "libudev-private.h"
+#include "udev-util.h"
 
 int manager_new(Manager **ret) {
         _cleanup_manager_free_ Manager *m = NULL;
@@ -204,19 +205,13 @@ finish:
 static int manager_dispatch_link_udev(sd_event_source *source, int fd, uint32_t revents, void *userdata) {
         Manager *m = userdata;
         struct udev_monitor *monitor = m->udev_monitor;
-        struct udev_device *device;
-        int r;
+        _cleanup_udev_device_unref_ struct udev_device *device = NULL;
 
         device = udev_monitor_receive_device(monitor);
         if (!device)
                 return -ENOMEM;
 
-        r = manager_process_link(m, device);
-        if (r < 0)
-                return r;
-
-        udev_device_unref(device);
-
+        manager_process_link(m, device);
         return 0;
 }