diff options
author | Denis Vlasenko | 2007-11-06 03:05:54 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-11-06 03:05:54 +0000 |
commit | 6bef3d1d2216234454875052220ca0f477a820b4 (patch) | |
tree | 717060345370b781d3d1cde7ab4dd29304a066e8 /miscutils/readahead.c | |
parent | 1bec1b980e3cf5ad604fb0c2038a3ab83d9ab5f5 (diff) | |
download | busybox-6bef3d1d2216234454875052220ca0f477a820b4.zip busybox-6bef3d1d2216234454875052220ca0f477a820b4.tar.gz |
fbset: fix buglet where we were using wrong pointer
readahead: stop using stdio.h
*: style fixes
Diffstat (limited to 'miscutils/readahead.c')
-rw-r--r-- | miscutils/readahead.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/miscutils/readahead.c b/miscutils/readahead.c index 647eb31..7b375cf 100644 --- a/miscutils/readahead.c +++ b/miscutils/readahead.c @@ -15,17 +15,15 @@ int readahead_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int readahead_main(int argc, char **argv) { - FILE *f; int retval = EXIT_SUCCESS; if (argc == 1) bb_show_usage(); while (*++argv) { - if ((f = fopen_or_warn(*argv, "r")) != NULL) { - int r, fd=fileno(f); - - r = readahead(fd, 0, fdlength(fd)); - fclose(f); + int fd = open_or_warn(*argv, O_RDONLY); + if (fd >= 0) { + int r = readahead(fd, 0, fdlength(fd)); + close(fd); if (r >= 0) continue; } retval = EXIT_FAILURE; |