diff options
author | Karel Zak | 2011-08-01 13:40:41 +0200 |
---|---|---|
committer | Karel Zak | 2011-08-01 13:40:41 +0200 |
commit | 24f010e8d42ceffd5bebc6801c0eaa7ec7d3241e (patch) | |
tree | a470a738459f428f766ad15142dcc3d58272411e /mount/swapon.c | |
parent | mount: fix compiler warnings [-Wsign-compare -Wunused-parameter] (diff) | |
download | kernel-qcow2-util-linux-24f010e8d42ceffd5bebc6801c0eaa7ec7d3241e.tar.gz kernel-qcow2-util-linux-24f010e8d42ceffd5bebc6801c0eaa7ec7d3241e.tar.xz kernel-qcow2-util-linux-24f010e8d42ceffd5bebc6801c0eaa7ec7d3241e.zip |
swapon: fix compiler warnings [-Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount/swapon.c')
-rw-r--r-- | mount/swapon.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mount/swapon.c b/mount/swapon.c index 8dd922248..2956a8e83 100644 --- a/mount/swapon.c +++ b/mount/swapon.c @@ -355,7 +355,7 @@ swap_get_header(int fd, int *sig, unsigned int *pagesize) continue; /* the smallest swap area is PAGE_SIZE*10, it means * 40k, that's less than MAX_PAGESIZE */ - if (datasz < (page - SWAP_SIGNATURE_SZ)) + if (datasz < 0 || (size_t) datasz < (page - SWAP_SIGNATURE_SZ)) break; if (swap_detect_signature(buf + page - SWAP_SIGNATURE_SZ, sig)) { *pagesize = page; @@ -458,6 +458,8 @@ swapon_checks(const char *special) if (sig == SIG_SWAPSPACE && pagesize) { unsigned long long swapsize = swap_get_size(hdr, special, pagesize); + int syspg = getpagesize(); + if (verbose) warnx(_("%s: pagesize=%d, swapsize=%llu, devsize=%llu"), special, pagesize, swapsize, devsize); @@ -467,7 +469,7 @@ swapon_checks(const char *special) warnx(_("%s: last_page 0x%08llx is larger" " than actual size of swapspace"), special, swapsize); - } else if (getpagesize() != pagesize) { + } else if (syspg < 0 || (unsigned) syspg != pagesize) { if (fixpgsz) { warnx(_("%s: swap format pagesize does not match."), special); |