diff options
Diffstat (limited to 'util-linux/mkswap.c')
-rw-r--r-- | util-linux/mkswap.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index 8e1fbc384..f047cce26 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c | |||
@@ -64,9 +64,11 @@ int mkswap_main(int argc, char **argv) | |||
64 | // Figure out how big the device is and announce our intentions. | 64 | // Figure out how big the device is and announce our intentions. |
65 | 65 | ||
66 | fd = xopen(argv[1], O_RDWR); | 66 | fd = xopen(argv[1], O_RDWR); |
67 | len = fdlength(fd); | 67 | /* fdlength was reported to be unreliable - use seek */ |
68 | len = xlseek(fd, 0, SEEK_END); | ||
69 | xlseek(fd, 0, SEEK_SET); | ||
68 | pagesize = getpagesize(); | 70 | pagesize = getpagesize(); |
69 | printf("Setting up swapspace version 1, size = %"OFF_FMT"d bytes\n", | 71 | printf("Setting up swapspace version 1, size = %"OFF_FMT"u bytes\n", |
70 | len - pagesize); | 72 | len - pagesize); |
71 | mkswap_selinux_setcontext(fd, argv[1]); | 73 | mkswap_selinux_setcontext(fd, argv[1]); |
72 | 74 | ||