summaryrefslogtreecommitdiff
path: root/config/udev.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-07-18 21:18:27 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2011-07-27 09:29:56 +1000
commit6cea28fe4b7a4a22ad270d8c71403db84a9bfb2c (patch)
tree4001d738e58bb896a98ab7853365767ee9f89de4 /config/udev.c
parentf13de9ca1b7c4dd0dd5c08037c6bd53f88ac30f5 (diff)
config: don't fail if a device vanished by the time we managed to look at it
The nature of hotplug is that a device we enumerated might already be gone by the time we look at it, so don't assume otherwise. Signed-off-by: Lennart Poettering <lennart@poettering.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'config/udev.c')
-rw-r--r--config/udev.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/config/udev.c b/config/udev.c
index 0763cc9a0..e7383dc36 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -301,6 +301,11 @@ config_udev_init(void)
udev_list_entry_foreach(device, devices) {
const char *syspath = udev_list_entry_get_name(device);
struct udev_device *udev_device = udev_device_new_from_syspath(udev, syspath);
+
+ /* Device might be gone by the time we try to open it */
+ if (!udev_device)
+ continue;
+
device_added(udev_device);
udev_device_unref(udev_device);
}