This fixes a corner case crash if a partition device node exists (like
/dev/sda5), but the corresponding drive device node (like /dev/sda) does not.
This should not happen in a running system, but was reported to occur during a
distribution upgrade.
Just handle the situation gracefully with a proper error message instead of
crashing.
http://bugs.freedesktop.org/show_bug.cgi?id=24468
Signed-off-by: David Zeuthen <davidz@redhat.com>
}
partition_table_device_file = g_strdup (udev_device_get_devnode (device));
udev_device_unref (device);
+ if (partition_table_device_file == NULL) {
+ /* This Should Not Happen™, but was reported in a distribution upgrade
+ scenario, so handle it gracefully */
+ g_printerr ("Error getting devnode from udev device path %s: %m\n", partition_table_devpath);
+ goto out;
+ }
g_free (partition_table_devpath);
} else {
/* not partition */