losetup: implement -r option. Closes 4033.

function                                             old     new   delta
packed_usage                                       28595   28633     +38
losetup_main                                         285     290      +5
singlemount                                          906     908      +2
set_loop                                             674     672      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2011-09-12 02:13:47 +02:00
parent dd1061b6a7
commit 13e709c53f
4 changed files with 17 additions and 13 deletions

View File

@ -1809,7 +1809,7 @@ static int singlemount(struct mntent *mp, int ignore_busy)
if (ENABLE_FEATURE_MOUNT_LOOP && S_ISREG(st.st_mode)) {
loopFile = bb_simplify_path(mp->mnt_fsname);
mp->mnt_fsname = NULL; // will receive malloced loop dev name
if (set_loop(&mp->mnt_fsname, loopFile, 0) < 0) {
if (set_loop(&mp->mnt_fsname, loopFile, 0, /*ro:*/ 0) < 0) {
if (errno == EPERM || errno == EACCES)
bb_error_msg(bb_msg_perm_denied_are_you_root);
else