Author: dim
Date: Wed Feb 24 07:53:57 2016
New Revision: 295963
URL: https://svnweb.freebsd.org/changeset/base/295963

Log:
  MFC r295844:
  
  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
  Differential Revision: https://reviews.freebsd.org/D5365

Modified:
  stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/cddl/   (props changed)
  stable/9/cddl/contrib/   (props changed)
  stable/9/cddl/contrib/opensolaris/   (props changed)
  stable/9/cddl/contrib/opensolaris/cmd/zfs/   (props changed)
  stable/9/cddl/contrib/opensolaris/cmd/zpool/   (props changed)

Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==============================================================================
--- stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c        Wed Feb 24 
06:05:30 2016        (r295962)
+++ stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c        Wed Feb 24 
07:53:57 2016        (r295963)
@@ -1678,7 +1678,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);
                                }
                        }
@@ -1715,7 +1715,7 @@ zfs_do_get(int argc, char **argv)
                                default:
                                        (void) fprintf(stderr,
                                            gettext("invalid source "
-                                           "'%s'\n"), value);
+                                           "'%s'\n"), suboptarg);
                                        usage(B_FALSE);
                                }
                        }
@@ -1751,7 +1751,7 @@ zfs_do_get(int argc, char **argv)
                                default:
                                        (void) fprintf(stderr,
                                            gettext("invalid type '%s'\n"),
-                                           value);
+                                           suboptarg);
                                        usage(B_FALSE);
                                }
                        }
@@ -3115,7 +3115,7 @@ zfs_do_list(int argc, char **argv)
                                default:
                                        (void) fprintf(stderr,
                                            gettext("invalid type '%s'\n"),
-                                           value);
+                                           suboptarg);
                                        usage(B_FALSE);
                                }
                        }

Modified: stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==============================================================================
--- stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c    Wed Feb 24 
06:05:30 2016        (r295962)
+++ stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c    Wed Feb 24 
07:53:57 2016        (r295963)
@@ -5293,7 +5293,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);
                                }
                        }
_______________________________________________
svn-src-stable-9@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"

Reply via email to