summaryrefslogtreecommitdiff
path: root/util-linux/mount.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux/mount.c')
-rw-r--r--util-linux/mount.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 455c333..eefbd76 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);
+ }
}