Fix device mount retry
[petitboot] / discover / device-handler.c
index 28889144c8f0285c3f90b0e5dd4dc4650c6f0a6f..0783181147edab9f0f8c6b7de9fa2ea35c516cb8 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, 1))
-               argv[3] = NULL; /* try without ro */
+       if (pb_run_cmd(argv, 1)) {
 
-       if (pb_run_cmd(argv, 1))
-               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;