OSDN Git Service

When mounting a ro fs rw, print warning and then mount it ro. Patch
authorEric Andersen <andersen@codepoet.org>
Wed, 20 Sep 2000 06:23:36 +0000 (06:23 -0000)
committerEric Andersen <andersen@codepoet.org>
Wed, 20 Sep 2000 06:23:36 +0000 (06:23 -0000)
from Dave Cinege.
 -Erik

mount.c
util-linux/mount.c

diff --git a/mount.c b/mount.c
index 455c333..eefbd76 100644 (file)
--- 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);
+               }
        }
 
 
index 455c333..eefbd76 100644 (file)
@@ -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);
+               }
        }