summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen2000-09-20 06:23:36 +0000
committerEric Andersen2000-09-20 06:23:36 +0000
commit0cccdfaf363171c9f0761fbdb2028db0ea73e6b5 (patch)
treec12a333e62bab534b5fb6c559f31ab924ed90d23
parentb938e2ff99d90620dc14d606a80354ec0264c6c4 (diff)
downloadbusybox-0cccdfaf363171c9f0761fbdb2028db0ea73e6b5.zip
busybox-0cccdfaf363171c9f0761fbdb2028db0ea73e6b5.tar.gz
When mounting a ro fs rw, print warning and then mount it ro. Patch
from Dave Cinege. -Erik
-rw-r--r--mount.c4
-rw-r--r--util-linux/mount.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/mount.c b/mount.c
index 455c333..eefbd76 100644
--- a/mount.c
+++ b/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);
+ }
}
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);
+ }
}