Devices that have been added via the user path may not have a device
path. In this case, don't segfault in device_match_path, and break out
of mount_device early.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
{
const char *argv[6];
+ if (!dev->device_path)
+ return -1;
+
if (!dev->mount_path)
dev->mount_path = join_paths(dev, mount_base(),
dev->device_path);
static int device_match_path(struct discover_device *dev, const char *path)
{
- return !strcmp(dev->device_path, path);
+ return dev->device_path && !strcmp(dev->device_path, path);
}
static int device_match_uuid(struct discover_device *dev, const char *uuid)