Eliminated optarg global being used outside of the function which called getopt
MFC after: 2 weeks
This commit is contained in:
parent
5b245b8ae0
commit
d9dab6e243
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=264851
@ -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':
|
||||
|
Loading…
Reference in New Issue
Block a user