summaryrefslogtreecommitdiff
path: root/src/expand.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/expand.c')
-rw-r--r--src/expand.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/expand.c b/src/expand.c
index be50063b6..249255d15 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -40,6 +40,7 @@
#include <sys/types.h>
#include "system.h"
#include "error.h"
+#include "fadvise.h"
#include "quote.h"
#include "xstrndup.h"
@@ -243,13 +244,14 @@ next_file (FILE *fp)
if (STREQ (file, "-"))
{
have_read_stdin = true;
- prev_file = file;
- return stdin;
+ fp = stdin;
}
- fp = fopen (file, "r");
+ else
+ fp = fopen (file, "r");
if (fp)
{
prev_file = file;
+ fadvise (fp, FADVISE_SEQUENTIAL);
return fp;
}
error (0, errno, "%s", file);