Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 May 2014 08:26:20 +0000 (UTC)
From:      Steven Hartland <smh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r265658 - stable/9/cddl/contrib/opensolaris/cmd/zfs
Message-ID:  <201405080826.s488QKEB086191@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: smh
Date: Thu May  8 08:26:20 2014
New Revision: 265658
URL: http://svnweb.freebsd.org/changeset/base/265658

Log:
  MFC r264851
  
  Eliminated optarg global being used outside of the function which called getopt
  
  Sponsored by:	Multiplay

Modified:
  stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
Directory Properties:
  stable/9/cddl/contrib/opensolaris/   (props changed)
  stable/9/cddl/contrib/opensolaris/cmd/zfs/   (props changed)

Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==============================================================================
--- stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c	Thu May  8 08:25:27 2014	(r265657)
+++ stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c	Thu May  8 08:26:20 2014	(r265658)
@@ -493,9 +493,8 @@ usage(boolean_t requested)
 }
 
 static int
-parseprop(nvlist_t *props)
+parseprop(nvlist_t *props, char *propname)
 {
-	char *propname = optarg;
 	char *propval, *strval;
 
 	if ((propval = strchr(propname, '=')) == NULL) {
@@ -524,7 +523,7 @@ parse_depth(char *opt, int *flags)
 	depth = (int)strtol(opt, &tmp, 0);
 	if (*tmp) {
 		(void) fprintf(stderr,
-		    gettext("%s is not an integer\n"), optarg);
+		    gettext("%s is not an integer\n"), opt);
 		usage(B_FALSE);
 	}
 	if (depth < 0) {
@@ -615,7 +614,7 @@ zfs_do_clone(int argc, char **argv)
 	while ((c = getopt(argc, argv, "o:p")) != -1) {
 		switch (c) {
 		case 'o':
-			if (parseprop(props))
+			if (parseprop(props, optarg))
 				return (1);
 			break;
 		case 'p':
@@ -762,7 +761,7 @@ zfs_do_create(int argc, char **argv)
 				nomem();
 			break;
 		case 'o':
-			if (parseprop(props))
+			if (parseprop(props, optarg))
 				goto error;
 			break;
 		case 's':
@@ -3623,7 +3622,7 @@ zfs_do_snapshot(int argc, char **argv)
 	while ((c = getopt(argc, argv, "ro:")) != -1) {
 		switch (c) {
 		case 'o':
-			if (parseprop(props))
+			if (parseprop(props, optarg))
 				return (1);
 			break;
 		case 'r':



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