# HG changeset patch # User Lasse Collin <lasse.collin@tukaani.org> # Date 1490900514 -10800 # Thu Mar 30 22:01:54 2017 +0300 # Node ID cf0cae1b8b9f25b192ee153af21d40dec11fc090 # Parent 0e2bd680c6f752bff509f3f6782500f4cec3e86b xz: Use POSIX_FADV_RANDOM for in "xz --list" mode. xz --list is random access so POSIX_FADV_SEQUENTIAL was clearly wrong. diff --git a/src/xz/file_io.c b/src/xz/file_io.c --- a/src/xz/file_io.c +++ b/src/xz/file_io.c @@ -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;