svn commit: r295844 - in head/cddl/contrib/opensolaris/cmd: zfs zpool

Dimitry Andric dim at FreeBSD.org
Sun Feb 21 13:04:00 UTC 2016


Author: dim
Date: Sun Feb 21 13:03:58 2016
New Revision: 295844
URL: https://svnweb.freebsd.org/changeset/base/295844

Log:
  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

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

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c	Sat Feb 20 22:58:33 2016	(r295843)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c	Sun Feb 21 13:03:58 2016	(r295844)
@@ -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);
 				}
 			}

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	Sat Feb 20 22:58:33 2016	(r295843)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	Sun Feb 21 13:03:58 2016	(r295844)
@@ -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);
 				}
 			}


More information about the svn-src-head mailing list