diff options
-rw-r--r-- | mount.c | 4 | ||||
-rw-r--r-- | util-linux/mount.c | 4 |
2 files changed, 8 insertions, 0 deletions
@@ -144,6 +144,10 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, } #endif status = mount(specialfile, dir, filesystemtype, flags, string_flags); + if (errno == EROFS) { + errorMsg("%s is write-protected, mounting read-only\n", specialfile); + status = mount(specialfile, dir, filesystemtype, flags |= MS_RDONLY, string_flags); + } } diff --git a/util-linux/mount.c b/util-linux/mount.c index 455c33303..eefbd76fd 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -144,6 +144,10 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, } #endif status = mount(specialfile, dir, filesystemtype, flags, string_flags); + if (errno == EROFS) { + errorMsg("%s is write-protected, mounting read-only\n", specialfile); + status = mount(specialfile, dir, filesystemtype, flags |= MS_RDONLY, string_flags); + } } |