Lars Ekman writes:

When using "losetup" the device is always setup as Read-Only.

(I have only tested with the -o flag, but looking at the code the
 problem seems general)

The problem is the "opt" variable in "losetup.c" that is reused in
the "set_loop()" call. Clear it before the call and everything is OK;

  opt = 0;         /* <-------- added line */
  if (delete)
    return del_loop (argv[optind]) ? EXIT_SUCCESS : EXIT_FAILURE;
  else
    return set_loop (argv[optind], argv[optind + 1], offset, &opt)
      ? EXIT_FAILURE : EXIT_SUCCESS;
}

Best Regards,
Lars Ekman
This commit is contained in:
Eric Andersen 2003-07-30 08:55:59 +00:00
parent 040f440262
commit 25f95dee2d

View File

@ -50,6 +50,7 @@ losetup_main (int argc, char **argv)
|| (!delete && optind + 2 != argc)) || (!delete && optind + 2 != argc))
bb_show_usage(); bb_show_usage();
opt = 0;
if (delete) if (delete)
return del_loop (argv[optind]) ? EXIT_SUCCESS : EXIT_FAILURE; return del_loop (argv[optind]) ? EXIT_SUCCESS : EXIT_FAILURE;
else else