Skip to content

Commit

Permalink
device: Ensure we have sysfs path before comparing.
Browse files Browse the repository at this point in the history
In some cases we do not have a udev device when setting up a unit
(certainly the code gracefully handles this). However, we do
then go on to compare the path via path_equal which will assert
if a null value is passed in.

See https://bugs.mageia.org/show_bug.cgi?id=17766

Not sure if this is the correct fix, but it avoids the crash
  • Loading branch information
Colin Guthrie committed Mar 14, 2016
1 parent ed0b16e commit 5e1558f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/device.c
Expand Up @@ -318,7 +318,7 @@ static int device_setup_unit(Manager *m, struct udev_device *dev, const char *pa
* the GC to have garbaged it. That's desired since the device
* unit may have a dependency on the mount unit which was
* added during the loading of the later. */
if (u && DEVICE(u)->state == DEVICE_PLUGGED) {
if (sysfs && u && DEVICE(u)->state == DEVICE_PLUGGED) {
/* This unit is in plugged state: we're sure it's
* attached to a device. */
if (!path_equal(DEVICE(u)->sysfs, sysfs)) {
Expand Down

0 comments on commit 5e1558f

Please sign in to comment.