]> git.ozlabs.org Git - petitboot/blobdiff - discover/device-handler.c
pb-discover: Ignore ram, loop and no-name devices
[petitboot] / discover / device-handler.c
index 6457dce6b68c5acf39ff8b8e5525a25b7caf9612..12bc40f7283a83bf24dac77e3e4f0f353deb55af 100644 (file)
@@ -201,11 +201,18 @@ static int mount_device(struct discover_context *ctx)
        argv[4] = "ro";
        argv[5] = NULL;
 
-       if (pb_run_cmd(argv))
-               argv[3] = NULL; /* try without ro */
+       if (pb_run_cmd(argv, 1)) {
 
-       if (pb_run_cmd(argv))
-               goto out_rmdir;
+               /* Retry mount without ro option. */
+
+               argv[0] = MOUNT_BIN;
+               argv[1] = ctx->device_path;
+               argv[2] = ctx->mount_path;
+               argv[3] = NULL;
+
+               if (pb_run_cmd(argv, 1))
+                       goto out_rmdir;
+       }
 
        setup_device_links(ctx);
        return 0;
@@ -287,11 +294,7 @@ static int handle_add_udev_event(struct device_handler *handler,
        ctx->id = talloc_strdup(ctx, event->device);
 
        devname = event_get_param(ctx->event, "DEVNAME");
-       if (!devname) {
-               pb_log("no devname for %s?\n", event->device);
-               return 0;
-       }
-
+       assert(devname);
        ctx->device_path = talloc_strdup(ctx, devname);
 
        rc = mount_device(ctx);