]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mkswap: fixed strtoll() usage
authorYann Droneaud <yann@droneaud.fr>
Tue, 30 Mar 2010 15:17:56 +0000 (17:17 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 30 Mar 2010 18:15:24 +0000 (20:15 +0200)
- catch empty string
- check against LLONG_MAX and LLONG_MIN instead of ULLONG_MAX and 0

Signed-off-by: Yann Droneaud <yann@droneaud.fr>
disk-utils/mkswap.c

index bc6c1d2916e649aaefaa98467395b71b182343cc..2bf07ddb2e7506e3322d5b87ecff3ebc06f5cd4f 100644 (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();