Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Apr 2014 01:12:53 +0000 (UTC)
From:      Steven Hartland <smh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r264851 - head/cddl/contrib/opensolaris/cmd/zfs
Message-ID:  <201404240112.s3O1CrSl043423@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: smh
Date: Thu Apr 24 01:12:52 2014
New Revision: 264851
URL: http://svnweb.freebsd.org/changeset/base/264851

Log:
  Eliminated optarg global being used outside of the function which called getopt
  
  MFC after:	2 weeks

Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c	Thu Apr 24 01:06:03 2014	(r264850)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c	Thu Apr 24 01:12:52 2014	(r264851)
@@ -495,9 +495,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) {
@@ -526,7 +525,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) {
@@ -617,7 +616,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':
@@ -767,7 +766,7 @@ zfs_do_create(int argc, char **argv)
 				nomem();
 			break;
 		case 'o':
-			if (parseprop(props))
+			if (parseprop(props, optarg))
 				goto error;
 			break;
 		case 's':
@@ -3636,7 +3635,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?201404240112.s3O1CrSl043423>