cvs commit: src/sys/ufs/ffs ffs_vfsops.c

Craig Rodrigues rodrigc at crodrigues.org
Tue May 30 15:45:02 PDT 2006


On Tue, May 30, 2006 at 11:11:34AM +0400, Maxim Konovalov wrote:
> [root at sonnie ~]# mount -u -o noexec,ro /vol0

Can you try this patch?


Index: mount.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount/mount.c,v
retrieving revision 1.84
diff -u -u -r1.84 mount.c
--- mount.c	10 May 2006 14:40:40 -0000	1.84
+++ mount.c	30 May 2006 20:13:23 -0000
@@ -184,6 +184,32 @@
 	return (0);
 }
 
+static
+int specified_ro(int argc, char *argv[])
+{
+	int i;
+	char *optbuf, *opt;
+	int ret = 0;
+
+	for (i=1; i < argc; i++) {
+		if (strcmp(argv[i-1], "-o") == 0) {
+			optbuf = strdup(argv[i]);
+			if (optbuf == NULL)
+				 err(1, NULL);
+
+			for (opt = optbuf; (opt = strtok(opt, ",")) != NULL;
+			    opt = NULL) {
+				if (strcmp(opt, "ro") == 0) {
+					ret = 1;
+					break;
+				}
+			}
+			free(optbuf);
+		}
+	}
+	return (ret);
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -200,6 +226,9 @@
 	options = NULL;
 	vfslist = NULL;
 	vfstype = "ufs";
+
+	if (specified_ro(argc, argv))
+		ro = 1;
 	while ((ch = getopt(argc, argv, "adF:fo:prwt:uv")) != -1)
 		switch (ch) {
 		case 'a':
-- 
Craig Rodrigues        
rodrigc at crodrigues.org


More information about the cvs-src mailing list