Currently mounting an image fails if it is readonly. set_loop checks only for EROFS to retry open with readonly mode, but in this case we get EACCES. Signed-off-by: Matthias Koenig <mkoenig@xxxxxxx> --- mount/lomount.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/mount/lomount.c b/mount/lomount.c index d4b746d..8b1eb12 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); -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html