aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-01-27 23:41:34 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-01-27 23:41:34 +0000
commitb5c60fc7870a66d89de571e96596b0745edcd6d9 (patch)
tree29b3595303de8e526b9f64d3a2d2456f783efe2a /util-linux
parentda42bd5bbe6fdda12133e7305b1a3e7cee506cc8 (diff)
downloadbusybox-b5c60fc7870a66d89de571e96596b0745edcd6d9.tar.gz
mkswap, readahead: stop using fdlength, it is reported to be unreliable
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/mkswap.c6
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)
// Figure out how big the device is and announce our intentions.
fd = xopen(argv[1], O_RDWR);
- len = fdlength(fd);
+ /* fdlength was reported to be unreliable - use seek */
+ len = xlseek(fd, 0, SEEK_END);
+ xlseek(fd, 0, SEEK_SET);
pagesize = getpagesize();
- printf("Setting up swapspace version 1, size = %"OFF_FMT"d bytes\n",
+ printf("Setting up swapspace version 1, size = %"OFF_FMT"u bytes\n",
len - pagesize);
mkswap_selinux_setcontext(fd, argv[1]);