valeriyvdovin / rpms / systemd

Forked from rpms/systemd 4 years ago
Clone

Blame SOURCES/0311-device-Ensure-we-have-sysfs-path-before-comparing.patch

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