mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
xz: Use POSIX_FADV_RANDOM for in "xz --list" mode.
xz --list is random access so POSIX_FADV_SEQUENTIAL was clearly wrong.
This commit is contained in:
parent
310d19816d
commit
bba477257d
1 changed files with 8 additions and 2 deletions
|
@ -525,7 +525,10 @@ io_open_src_real(file_pair *pair)
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_POSIX_FADVISE
|
#ifdef HAVE_POSIX_FADVISE
|
||||||
// It will fail if stdin is a pipe and that's fine.
|
// 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
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -716,7 +719,10 @@ io_open_src_real(file_pair *pair)
|
||||||
|
|
||||||
#ifdef HAVE_POSIX_FADVISE
|
#ifdef HAVE_POSIX_FADVISE
|
||||||
// It will fail with some special files like FIFOs but that is fine.
|
// 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
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue