summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mount/lomount.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mount/lomount.c b/mount/lomount.c
index d4b746d35..8b1eb126a 100644
--- a/mount/lomount.c
+++ b/mount/lomount.c
@@ -671,7 +671,8 @@ set_loop(const char *device, const char *file, unsigned long long offset,
mode = (*options & SETLOOP_RDONLY) ? O_RDONLY : O_RDWR;
if ((ffd = open(file, mode)) < 0) {
- if (!(*options & SETLOOP_RDONLY) && errno == EROFS)
+ if (!(*options & SETLOOP_RDONLY) &&
+ (errno == EROFS || errno == EACCES))
ffd = open(file, mode = O_RDONLY);
if (ffd < 0) {
perror(file);