From e84091cb52120dd6c88d0570581c4563f4f80fbb Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Fri, 21 Sep 2007 10:00:05 +0000 Subject: [PATCH] For arguments declared as numbers always use expand_number(3). This allows to use numbers in human-readable form in many geom(8) utilities. Such a simple change and makes live so much nicer. Some examples: gstripe label -s 16k gmirror label -s 4k gnop create -o 1g -s 128m -S 2k gjournal label -s 2g geli label -i 128k -s 4k Approved by: re (kensmith) --- sbin/geom/core/geom.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c index 472c659eb6c5..cfa1e6074ad4 100644 --- a/sbin/geom/core/geom.c +++ b/sbin/geom/core/geom.c @@ -224,9 +224,7 @@ set_option(struct gctl_req *req, struct g_option *opt, const char *val) if (G_OPT_TYPE(opt) == G_TYPE_NUMBER) { intmax_t number; - errno = 0; - number = strtoimax(val, NULL, 0); - if (errno != 0) { + if (expand_number(val, &number) == -1) { err(EXIT_FAILURE, "Invalid value for '%c' argument.", opt->go_char); }