aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2005-10-11 07:26:15 +0000
committerlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2005-10-11 07:26:15 +0000
commitb30a4590a2a185ed36221548661507f65345b0ac (patch)
tree78de3691d83082ad26c2b2c02cc60d46bd912ed8 /libbb
parent215f0cb31fd9cc19909f582587723709062eee62 (diff)
downloadbusybox-w32-b30a4590a2a185ed36221548661507f65345b0ac.tar.gz
busybox-w32-b30a4590a2a185ed36221548661507f65345b0ac.tar.bz2
busybox-w32-b30a4590a2a185ed36221548661507f65345b0ac.zip
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. git-svn-id: svn://busybox.net/trunk/busybox@11825 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'libbb')
-rw-r--r--libbb/loop.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libbb/loop.c b/libbb/loop.c
index 25f66fcea..f7029d591 100644
--- a/libbb/loop.c
+++ b/libbb/loop.c
@@ -88,10 +88,9 @@ extern int set_loop(char **device, const char *file, int offset)
88 int i, dfd, ffd, mode, rc=1; 88 int i, dfd, ffd, mode, rc=1;
89 89
90 // Open the file. Barf if this doesn't work. 90 // Open the file. Barf if this doesn't work.
91 if((ffd = open(file, mode=O_RDWR))<0) 91 if((ffd = open(file, mode=O_RDWR))<0 && (ffd = open(file,mode=O_RDONLY))<0)
92 if(errno!=EROFS || (ffd=open(file,mode=O_RDONLY))<0) 92 return errno;
93 return errno; 93
94
95 // Find a loop device 94 // Find a loop device
96 for(i=0;rc;i++) { 95 for(i=0;rc;i++) {
97 sprintf(dev, LOOP_FORMAT, i++); 96 sprintf(dev, LOOP_FORMAT, i++);