]> git.ozlabs.org Git - petitboot/commitdiff
discover: Don't continue discovery if mount fails
authorJeremy Kerr <jk@ozlabs.org>
Tue, 1 Oct 2013 03:03:48 +0000 (11:03 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Tue, 1 Oct 2013 04:51:59 +0000 (12:51 +0800)
Check the return value from mount_device and abort the discover on
failure.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/device-handler.c

index cd9c41386ea07bdaa9762f75ac3ec81648c5b280..8b4046edd83e52a686a7ee0b29768a4bffb1f36f 100644 (file)
@@ -586,13 +586,16 @@ int device_handler_discover(struct device_handler *handler,
                struct discover_device *dev, enum conf_method method)
 {
        struct discover_context *ctx;
                struct discover_device *dev, enum conf_method method)
 {
        struct discover_context *ctx;
+       int rc;
 
        process_boot_option_queue(handler);
 
        /* create our context */
        ctx = device_handler_discover_context_create(handler, dev);
 
 
        process_boot_option_queue(handler);
 
        /* create our context */
        ctx = device_handler_discover_context_create(handler, dev);
 
-       mount_device(dev);
+       rc = mount_device(dev);
+       if (rc)
+               goto out;
 
        /* run the parsers. This will populate the ctx's boot_option list. */
        iterate_parsers(ctx, method);
 
        /* run the parsers. This will populate the ctx's boot_option list. */
        iterate_parsers(ctx, method);
@@ -600,6 +603,7 @@ int device_handler_discover(struct device_handler *handler,
        /* add discovered stuff to the handler */
        device_handler_discover_context_commit(handler, ctx);
 
        /* add discovered stuff to the handler */
        device_handler_discover_context_commit(handler, ctx);
 
+out:
        talloc_free(ctx);
 
        return 0;
        talloc_free(ctx);
 
        return 0;