]> git.proxmox.com Git - mirror_zfs.git/commit
libzutil: zfs_isnumber(): return false if input empty
authorнаб <nabijaczleweli@nabijaczleweli.xyz>
Tue, 6 Apr 2021 19:25:53 +0000 (21:25 +0200)
committerGitHub <noreply@github.com>
Tue, 6 Apr 2021 19:25:53 +0000 (12:25 -0700)
commit61b50107a58a1da9d86f5f81dc35d039ca629aae
treed993ac52cb1f4261e553ad41b5f77ea83a15c267
parentec580225d2b2fb78ea9e12d0b08a185fbb50c7a6
libzutil: zfs_isnumber(): return false if input empty

zpool list, which is the only user, would mistakenly try to parse the
empty string as the interval in this case:

  $ zpool list "a"
  cannot open 'a': no such pool
  $ zpool list ""
  interval cannot be zero
  usage: <usage string follows>
which is now symmetric with zpool get:
  $ zpool list ""
  cannot open '': name must begin with a letter

Avoid breaking the  "interval cannot be zero" string.
There simply isn't a need for this, and it's user-facing.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11841
Closes #11843
cmd/zpool/zpool_main.c
lib/libzutil/zutil_nicenum.c