diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2013-05-13 10:08:47 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2013-05-15 14:50:25 +0800 |
commit | 198c4e575e177ae5458238e7b474361506a6f302 (patch) | |
tree | da03f94a8decd442f1853dda8558fa10695dee5a /discover/device-handler.c | |
parent | 1b50985db4e85030de3567792aedc13aa26e0fea (diff) | |
download | talos-petitboot-198c4e575e177ae5458238e7b474361506a6f302.tar.gz talos-petitboot-198c4e575e177ae5458238e7b474361506a6f302.zip |
discover: Allow devices with no device_path
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>
Diffstat (limited to 'discover/device-handler.c')
-rw-r--r-- | discover/device-handler.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/discover/device-handler.c b/discover/device-handler.c index 43171eb..2396124 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -235,6 +235,9 @@ static int mount_device(struct discover_device *dev) { 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); @@ -576,7 +579,7 @@ void device_handler_destroy(struct device_handler *handler) 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) |