shithub: unionfs

Download patch

ref: c1f1f16b8835d7c0f0ea6ba446da8a6f34edd364
parent: e62e30372a328a1b3f1e7f3b737978bca5b0b71d
author: kvik <[email protected]>
date: Sun Apr 19 18:44:24 EDT 2020

Only default-mount if no -s or -m are given

Unionfs used to always mount itself on a default mountpoint
/mnt/union, because reasons.  Flag -M disabled such pointless
behaviour — at the cost of being pointless itself.

We now default-mount only in case the user didn't ask for
anything else.

--- a/unionfs.c
+++ b/unionfs.c
@@ -698,7 +698,7 @@
 void
 usage(void)
 {
-	fprint(2, "%s [-abiC] [-M | -m mtpt] [-s srv] [-c] path ...\n", argv0);
+	fprint(2, "%s [-abiC] [-m mtpt] [-s srv] [-c] path ...\n", argv0);
 	exits("usage");
 }
 
@@ -712,7 +712,7 @@
 
 	c = 0;
 	mflag = MREPL|MCREATE;
-	mtpt = "/mnt/union";
+	mtpt = nil;
 	srvname = nil;
 	stdio = 0;
 	ARGBEGIN{
@@ -734,9 +734,6 @@
 	case 'm':
 		mtpt = EARGF(usage());
 		break;
-	case 'M':
-		mtpt = nil;
-		break;
 	case 's':
 		srvname = EARGF(usage());
 		break;
@@ -748,12 +745,14 @@
 	}ARGEND;
 	if(argc < 1)
 		usage();
+	if((mtpt || srvname) == 0)
+		mtpt = "/mnt/union";
 	for(i = 0; i < argc; i++){
 		if(strncmp(argv[i], "-c", 2) == 0){
 			c++;
 			continue;
 		}
-		if(strcmp(argv[i], mtpt) == 0){
+		if(mtpt && strcmp(argv[i], mtpt) == 0){
 			fprint(2, "%s: mountpoint cycle, skipping branch %s\n", argv0, argv[i]);
 			continue;
 		}
--- a/unionfs.man
+++ b/unionfs.man
@@ -6,8 +6,6 @@
 [
 .B -abiC
 ] [
-.B -M
-|
 .B -m
 .I mtpt
 ] [
@@ -56,8 +54,6 @@
 .IR mtpt ;
 .I /mnt/union
 by default.
-.I -M
-disables automatic mounting.
 .TP
 .BI -s \ srvname
 Post channel to