Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Apr 2009 20:00:38 +0300
From:      Jaakko Heinonen <jh@saunalahti.fi>
To:        freebsd-current@FreeBSD.org
Subject:   [patch] mount_nfs(8) option parsing bug
Message-ID:  <20090406170038.GA4058@a91-153-125-115.elisa-laajakaista.fi>

next in thread | raw e-mail | index | archive | help

Hi,

mount_nfs(8) doesn't parse options specified with -o correctly if an
option with value is preceded by an option without value.

# mount_nfs -o rdirplus,acdirmax=0 localhost:/dir /mnt
mount_nfs: /mnt, illegal acdirmax: : Invalid argument

Possible fix:

%%%
Index: sbin/mount_nfs/mount_nfs.c
===================================================================
--- sbin/mount_nfs/mount_nfs.c	(revision 190637)
+++ sbin/mount_nfs/mount_nfs.c	(working copy)
@@ -265,16 +265,16 @@ main(int argc, char *argv[])
 				char *pnextopt = NULL;
 				char *val = "";
 				pass_flag_to_nmount = 1;
-				pval = strchr(opt, '=');
 				pnextopt = strchr(opt, ',');
-				if (pval != NULL) {
-					*pval = '\0';
-					val = pval + 1;
-				}
 				if (pnextopt) {
 					*pnextopt = '\0';
 					pnextopt++;
 				}
+				pval = strchr(opt, '=');
+				if (pval != NULL) {
+					*pval = '\0';
+					val = pval + 1;
+				}
 				if (strcmp(opt, "bg") == 0) {
 					opflags |= BGRND;
 					pass_flag_to_nmount=0;
%%%

-- 
Jaakko



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090406170038.GA4058>