diff options
author | neel <neel@FreeBSD.org> | 2013-10-09 03:56:07 +0000 |
---|---|---|
committer | neel <neel@FreeBSD.org> | 2013-10-09 03:56:07 +0000 |
commit | f9f9a7e61707f80f49be34d2c1af7490549580f9 (patch) | |
tree | acc9a278b9f141070d676a08d2877d23277d20e2 /usr.sbin/bhyveload/bhyveload.c | |
parent | 97e97b35c8417bc9679c023105f5f38512994440 (diff) | |
download | FreeBSD-src-f9f9a7e61707f80f49be34d2c1af7490549580f9.zip FreeBSD-src-f9f9a7e61707f80f49be34d2c1af7490549580f9.tar.gz |
Parse the memory size parameter using expand_number() to allow specifying
the memory size more intuitively (e.g. 512M, 4G etc).
Submitted by: rodrigc
Reviewed by: grehan
Approved by: re (blanket)
Diffstat (limited to 'usr.sbin/bhyveload/bhyveload.c')
-rw-r--r-- | usr.sbin/bhyveload/bhyveload.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/bhyveload/bhyveload.c b/usr.sbin/bhyveload/bhyveload.c index c4bafd3..6e541e8 100644 --- a/usr.sbin/bhyveload/bhyveload.c +++ b/usr.sbin/bhyveload/bhyveload.c @@ -67,12 +67,14 @@ __FBSDID("$FreeBSD$"); #include <dirent.h> #include <dlfcn.h> #include <errno.h> +#include <err.h> #include <fcntl.h> #include <getopt.h> #include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <sysexits.h> #include <termios.h> #include <unistd.h> @@ -581,9 +583,10 @@ main(int argc, char** argv) break; case 'm': - mem_size = strtoul(optarg, NULL, 0) * MB; + error = vm_parse_memsize(optarg, &mem_size); + if (error != 0) + errx(EX_USAGE, "Invalid memsize '%s'", optarg); break; - case '?': usage(); } |