Fix "invalid type '(null)'" usage messages in zfs(8) and zpool(8).

Currently, zfs(8) and zpool(8) print "invalid type '(null)'" or similar
messages, if you pass in invalid types, sources or column names for "zfs
get", "zfs list" and "zpool get".  This is because the commands use
getsubopt(3), and in case of failure, they print 'value', which is NULL
when sub options don't match.

They should print 'suboptarg' instead, which is the documented way to
get at the non-matching sub option value.

Reviewed by:	smh
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D5365
This commit is contained in:
Dimitry Andric 2016-02-21 13:03:58 +00:00
parent f4cd39e3b2
commit 1e1bbb79fd
2 changed files with 5 additions and 5 deletions

View file

@ -1713,7 +1713,7 @@ zfs_do_get(int argc, char **argv)
default:
(void) fprintf(stderr,
gettext("invalid column name "
"'%s'\n"), value);
"'%s'\n"), suboptarg);
usage(B_FALSE);
}
}
@ -1750,7 +1750,7 @@ zfs_do_get(int argc, char **argv)
default:
(void) fprintf(stderr,
gettext("invalid source "
"'%s'\n"), value);
"'%s'\n"), suboptarg);
usage(B_FALSE);
}
}
@ -1786,7 +1786,7 @@ zfs_do_get(int argc, char **argv)
default:
(void) fprintf(stderr,
gettext("invalid type '%s'\n"),
value);
suboptarg);
usage(B_FALSE);
}
}
@ -3156,7 +3156,7 @@ zfs_do_list(int argc, char **argv)
default:
(void) fprintf(stderr,
gettext("invalid type '%s'\n"),
value);
suboptarg);
usage(B_FALSE);
}
}

View file

@ -5431,7 +5431,7 @@ zpool_do_get(int argc, char **argv)
default:
(void) fprintf(stderr,
gettext("invalid column name "
"'%s'\n"), value);
"'%s'\n"), suboptarg);
usage(B_FALSE);
}
}