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 <yann@droneaud.fr>
This commit is contained in:
Yann Droneaud 2010-03-30 17:17:56 +02:00 committed by Karel Zak
parent 588c2685f4
commit 11ba4182e6
1 changed files with 3 additions and 2 deletions

View File

@ -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();