Skip to content
Snippets Groups Projects
Commit cf0cae1b8b9f authored by Lasse Collin's avatar Lasse Collin
Browse files

xz: Use POSIX_FADV_RANDOM for in "xz --list" mode.

xz --list is random access so POSIX_FADV_SEQUENTIAL was clearly
wrong.
parent 0e2bd680c6f7
No related branches found
No related tags found
No related merge requests found
......@@ -525,7 +525,10 @@
#endif
#ifdef HAVE_POSIX_FADVISE
// It will fail if stdin is a pipe and that's fine.
(void)posix_fadvise(STDIN_FILENO, 0, 0, POSIX_FADV_SEQUENTIAL);
(void)posix_fadvise(STDIN_FILENO, 0, 0,
opt_mode == MODE_LIST
? POSIX_FADV_RANDOM
: POSIX_FADV_SEQUENTIAL);
#endif
return false;
}
......@@ -716,7 +719,10 @@
#ifdef HAVE_POSIX_FADVISE
// It will fail with some special files like FIFOs but that is fine.
(void)posix_fadvise(pair->src_fd, 0, 0, POSIX_FADV_SEQUENTIAL);
(void)posix_fadvise(pair->src_fd, 0, 0,
opt_mode == MODE_LIST
? POSIX_FADV_RANDOM
: POSIX_FADV_SEQUENTIAL);
#endif
return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment