923a60
From ce046ce7f8545d174dc8ecb45b27c2049d96f935 Mon Sep 17 00:00:00 2001
923a60
From: Colin Guthrie <colin@mageia.org>
923a60
Date: Mon, 14 Mar 2016 09:42:07 +0000
923a60
Subject: [PATCH] device: Ensure we have sysfs path before comparing.
923a60
923a60
In some cases we do not have a udev device when setting up a unit
923a60
(certainly the code gracefully handles this). However, we do
923a60
then go on to compare the path via path_equal which will assert
923a60
if a null value is passed in.
923a60
923a60
See https://bugs.mageia.org/show_bug.cgi?id=17766
923a60
923a60
Not sure if this is the correct fix, but it avoids the crash
923a60
923a60
Cherry-picked from: 5e1558f4a09e596561c9168384f2258e7c0718a1
923a60
Resolves: #1332606
923a60
---
923a60
 src/core/device.c | 2 +-
923a60
 1 file changed, 1 insertion(+), 1 deletion(-)
923a60
923a60
diff --git a/src/core/device.c b/src/core/device.c
923a60
index fc73e263ab..bdc8466abc 100644
923a60
--- a/src/core/device.c
923a60
+++ b/src/core/device.c
923a60
@@ -319,7 +319,7 @@ static int device_setup_unit(Manager *m, struct udev_device *dev, const char *pa
923a60
          * the GC to have garbaged it. That's desired since the device
923a60
          * unit may have a dependency on the mount unit which was
923a60
          * added during the loading of the later. */
923a60
-        if (u && DEVICE(u)->state == DEVICE_PLUGGED) {
923a60
+        if (sysfs && u && DEVICE(u)->state == DEVICE_PLUGGED) {
923a60
                 /* This unit is in plugged state: we're sure it's
923a60
                  * attached to a device. */
923a60
                 if (!path_equal(DEVICE(u)->sysfs, sysfs)) {