From faf46ad3163698342bceec7848fc76cee1796c4a Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Mon, 11 May 2015 17:04:11 +0200 Subject: [PATCH] linux-platforms: don't enumerate devices via udev if udevd is not running We'd be able to do so for already existing devices, but not for devices that are added afterwards, since gudev is hardwired not to listen for events from kernel. (cherry picked from commit 26aeb12749c6b81bd0e3b7aee8fe2b639353b102) --- src/platform/nm-linux-platform.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 3fa7f8f0a3..5d35716f95 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -1118,6 +1118,12 @@ init_link (NMPlatform *platform, NMPlatformLink *info, struct rtnl_link *rtnllin if (!info->driver) info->driver = "unknown"; + /* Only demand further initialization (udev rules ran, device has + * a stable name now) in case udev is running (not in a container). */ + if ( !info->initialized + && access ("/sys", W_OK) != 0) + info->initialized = TRUE; + return TRUE; } @@ -4738,11 +4744,7 @@ setup_devices (NMPlatform *platform) enumerator = g_udev_enumerator_new (priv->udev_client); g_udev_enumerator_add_match_subsystem (enumerator, "net"); - /* Demand that the device is initialized (udev rules ran, - * device has a stable name now) in case udev is running - * (not in a container). */ - if (access ("/sys", W_OK) == 0) - g_udev_enumerator_add_match_is_initialized (enumerator); + g_udev_enumerator_add_match_is_initialized (enumerator); devices = g_udev_enumerator_execute (enumerator); for (iter = devices; iter; iter = g_list_next (iter)) {