discover/device-handler: Be ready for user events earlier
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>
Tue, 15 Aug 2017 01:08:58 +0000 (11:08 +1000)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Tue, 15 Aug 2017 03:38:17 +0000 (13:38 +1000)
Actions performed in network and udev init may result in pb-event
callbacks (such as from udhcpc or pb-plugin), so make sure the user
event interface is set up beforehand.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
discover/device-handler.c

index 94a3f1c847f09fd3c26e22c88edbfb42ac365924..f1270c8ca660b7c771f0e08023e4559345f1e5bc 100644 (file)
@@ -1563,6 +1563,10 @@ static void device_handler_update_lang(const char *lang)
 static int device_handler_init_sources(struct device_handler *handler)
 {
        /* init our device sources: udev, network and user events */
+       handler->user_event = user_event_init(handler, handler->waitset);
+       if (!handler->user_event)
+               return -1;
+
        handler->network = network_init(handler, handler->waitset,
                        handler->dry_run);
        if (!handler->network)
@@ -1572,10 +1576,6 @@ static int device_handler_init_sources(struct device_handler *handler)
        if (!handler->udev)
                return -1;
 
-       handler->user_event = user_event_init(handler, handler->waitset);
-       if (!handler->user_event)
-               return -1;
-
        return 0;
 }