summaryrefslogtreecommitdiffstats
path: root/disk-utils/mkswap.c
diff options
context:
space:
mode:
authorYann Droneaud2010-03-30 17:17:56 +0200
committerKarel Zak2010-03-30 20:15:24 +0200
commit11ba4182e6b48e088189729d68b4d0bc7a5e4619 (patch)
tree8216bdc7ebdf3e0da86a7e5831d2aff765b1c669 /disk-utils/mkswap.c
parentmount: support suffixes for offset= and sizelimit= (diff)
downloadkernel-qcow2-util-linux-11ba4182e6b48e088189729d68b4d0bc7a5e4619.tar.gz
kernel-qcow2-util-linux-11ba4182e6b48e088189729d68b4d0bc7a5e4619.tar.xz
kernel-qcow2-util-linux-11ba4182e6b48e088189729d68b4d0bc7a5e4619.zip
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>
Diffstat (limited to 'disk-utils/mkswap.c')
-rw-r--r--disk-utils/mkswap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c
index bc6c1d291..2bf07ddb2 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();