mirror of
https://git.busybox.net/busybox
synced 2026-01-31 16:43:21 +00:00
The check for EROFS was wrong. For example, if you try to mount a filesystem
appended to an executable that's being run (yes, I'm doing this) you get EPERM, but mounting readonly fixes it. Doing the fallback all the time shouldn't hurt, and is one less test.
This commit is contained in:
parent
554a9ff7ea
commit
ff567f7943
1 changed files with 3 additions and 4 deletions
|
|
@ -88,10 +88,9 @@ extern int set_loop(char **device, const char *file, int offset)
|
|||
int i, dfd, ffd, mode, rc=1;
|
||||
|
||||
// Open the file. Barf if this doesn't work.
|
||||
if((ffd = open(file, mode=O_RDWR))<0)
|
||||
if(errno!=EROFS || (ffd=open(file,mode=O_RDONLY))<0)
|
||||
return errno;
|
||||
|
||||
if((ffd = open(file, mode=O_RDWR))<0 && (ffd = open(file,mode=O_RDONLY))<0)
|
||||
return errno;
|
||||
|
||||
// Find a loop device
|
||||
for(i=0;rc;i++) {
|
||||
sprintf(dev, LOOP_FORMAT, i++);
|
||||
|
|
|
|||
Loading…
Reference in a new issue