MFC r264851

Eliminated optarg global being used outside of the function which called getopt

Sponsored by:	Multiplay
This commit is contained in:
smh 2014-05-08 08:17:12 +00:00
parent 8c42300872
commit c84c4e2d80

View File

@ -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':