diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-01-27 23:41:34 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-01-27 23:41:34 +0000 |
| commit | b5c60fc7870a66d89de571e96596b0745edcd6d9 (patch) | |
| tree | 29b3595303de8e526b9f64d3a2d2456f783efe2a /miscutils | |
| parent | da42bd5bbe6fdda12133e7305b1a3e7cee506cc8 (diff) | |
| download | busybox-w32-b5c60fc7870a66d89de571e96596b0745edcd6d9.tar.gz busybox-w32-b5c60fc7870a66d89de571e96596b0745edcd6d9.tar.bz2 busybox-w32-b5c60fc7870a66d89de571e96596b0745edcd6d9.zip | |
mkswap, readahead: stop using fdlength, it is reported to be unreliable
Diffstat (limited to 'miscutils')
| -rw-r--r-- | miscutils/readahead.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/miscutils/readahead.c b/miscutils/readahead.c index 7b375cfff..fb71ce85f 100644 --- a/miscutils/readahead.c +++ b/miscutils/readahead.c | |||
| @@ -22,9 +22,16 @@ int readahead_main(int argc, char **argv) | |||
| 22 | while (*++argv) { | 22 | while (*++argv) { |
| 23 | int fd = open_or_warn(*argv, O_RDONLY); | 23 | int fd = open_or_warn(*argv, O_RDONLY); |
| 24 | if (fd >= 0) { | 24 | if (fd >= 0) { |
| 25 | int r = readahead(fd, 0, fdlength(fd)); | 25 | off_t len; |
| 26 | int r; | ||
| 27 | |||
| 28 | /* fdlength was reported to be unreliable - use seek */ | ||
| 29 | len = xlseek(fd, 0, SEEK_END); | ||
| 30 | xlseek(fd, 0, SEEK_SET); | ||
| 31 | r = readahead(fd, 0, len); | ||
| 26 | close(fd); | 32 | close(fd); |
| 27 | if (r >= 0) continue; | 33 | if (r >= 0) |
| 34 | continue; | ||
| 28 | } | 35 | } |
| 29 | retval = EXIT_FAILURE; | 36 | retval = EXIT_FAILURE; |
| 30 | } | 37 | } |
