bin/120784: [patch] mount(8): allow mount from fstab with 3rd party tools like ntfs-3g

Dominic Fandrey LoN_Kamikaze at gmx.de
Mon Feb 18 21:13:55 UTC 2008


Remko Lodder wrote:
> I couldn't read the .diff file, it was encoded.
> 
> Can you submit it as plain text? possibly send it inline instead of
> attaching it?
> 
> Thanks,
> remko
> 

Sorry about that. The file appears to have arrived corrupted.

diff -Pur sbin/mount.orig/mount.c sbin/mount/mount.c
--- sbin/mount.orig/mount.c	2008-02-18 19:44:05.000000000 +0100
+++ sbin/mount/mount.c	2008-02-18 19:44:37.000000000 +0100
@@ -560,7 +560,12 @@
  	if (use_mountprog(vfstype)) {
  		ret = exec_mountprog(name, execname, argv);
  	} else {
-		ret = mount_fs(vfstype, argc, argv);
+		ret = mount_fs(vfstype, argc, argv);
+		if (ret < 0) {
+			if (verbose)
+				warn("falling back to old style mount");
+			ret = exec_mountprog(name, execname, argv);
+		}
  	}

  	free(optbuf);
diff -Pur sbin/mount.orig/mount_fs.c sbin/mount/mount_fs.c
--- sbin/mount.orig/mount_fs.c	2008-02-18 19:44:05.000000000 +0100
+++ sbin/mount/mount_fs.c	2008-02-18 19:44:37.000000000 +0100
@@ -107,6 +107,11 @@
  				val = p + 1;
  			}
  			build_iovec(&iov, &iovlen, optarg, val, (size_t)-1);
+			// Repair arguments, in case they are required when
+			// falling back to the old style exec_mountprog.
+			if (p != NULL) {
+				*p = '=';
+			}
  			break;
  		case '?':
  		default:
@@ -131,8 +136,6 @@
  	build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
  	
  	ret = nmount(iov, iovlen, mntflags);
-	if (ret < 0)
-		err(1, "%s %s", dev, errmsg);

  	return (ret);
  }



More information about the freebsd-bugs mailing list