X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=lib%2Flibzfs%2Flibzfs_util.c;h=f55b658d041dfbf6d5e566c9e5d6ea6fd79d46cf;hb=8a7e1ceefa430988c8f888ca708ab307333b4464;hp=da1b9bcddf8214464cfe2fde76ad27da061dfe26;hpb=9ac97c2a939aef0f9899244920007c605387949a;p=zfs.git diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index da1b9bc..f55b658 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -1186,11 +1186,14 @@ str2shift(libzfs_handle_t *hdl, const char *buf) } /* - * We want to allow trailing 'b' characters for 'GB' or 'Mb'. But don't - * allow 'BB' - that's just weird. + * Allow 'G' = 'GB' = 'GiB', case-insensitively. + * However, 'BB' and 'BiB' are disallowed. */ - if (buf[1] == '\0' || (toupper(buf[1]) == 'B' && buf[2] == '\0' && - toupper(buf[0]) != 'B')) + if (buf[1] == '\0' || + (toupper(buf[0]) != 'B' && + ((toupper(buf[1]) == 'B' && buf[2] == '\0') || + (toupper(buf[1]) == 'I' && toupper(buf[2]) == 'B' && + buf[3] == '\0')))) return (10*i); zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,