summaryrefslogtreecommitdiffstats
path: root/sbin/geom/core
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2007-09-21 10:00:05 +0000
committerpjd <pjd@FreeBSD.org>2007-09-21 10:00:05 +0000
commit427fb1f9be8e582a99ba5f06375c89296481d692 (patch)
treebe3a83893e26a63e05575df29f8b948c352e842b /sbin/geom/core
parent5f96c6e1c1c73cc84c4ccc580b171863de4c77ee (diff)
downloadFreeBSD-src-427fb1f9be8e582a99ba5f06375c89296481d692.zip
FreeBSD-src-427fb1f9be8e582a99ba5f06375c89296481d692.tar.gz
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)
Diffstat (limited to 'sbin/geom/core')
-rw-r--r--sbin/geom/core/geom.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c
index 472c659..cfa1e60 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);
}
OpenPOWER on IntegriCloud