From 0cccdfaf363171c9f0761fbdb2028db0ea73e6b5 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 20 Sep 2000 06:23:36 +0000 Subject: [PATCH] When mounting a ro fs rw, print warning and then mount it ro. Patch from Dave Cinege. -Erik --- mount.c | 4 ++++ util-linux/mount.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/mount.c b/mount.c index 455c33303..eefbd76fd 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 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); + } }