[patch] mount_nfs(8) option parsing bug

From: Jaakko Heinonen <jh_at_saunalahti.fi>
Date: Mon, 6 Apr 2009 20:00:38 +0300
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)
_at__at_ -265,16 +265,16 _at__at_ 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
Received on Mon Apr 06 2009 - 15:00:41 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:45 UTC