From: Yann Droneaud Date: Tue, 30 Mar 2010 15:17:56 +0000 (+0200) Subject: mkswap: fixed strtoll() usage X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11ba4182e6b48e088189729d68b4d0bc7a5e4619;p=util-linux mkswap: fixed strtoll() usage - catch empty string - check against LLONG_MAX and LLONG_MIN instead of ULLONG_MAX and 0 Signed-off-by: Yann Droneaud --- diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c index bc6c1d29..2bf07ddb 100644 --- a/disk-utils/mkswap.c +++ b/disk-utils/mkswap.c @@ -565,8 +565,9 @@ main(int argc, char ** argv) { errno = 0; blks = strtoll(block_count, &tmp, 0); - if ((tmp && *tmp) || - (errno != 0 && (blks == ULLONG_MAX || blks == 0)) || + if ((tmp == block_count) || + (tmp && *tmp) || + (errno != 0 && (blks == LLONG_MAX || blks == LLONG_MIN)) || blks < 0) usage();