diff options
-rw-r--r-- | libbb/loop.c | 7 |
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++); |