aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2013-06-28 14:55:37 +0300
committerLasse Collin <lasse.collin@tukaani.org>2013-06-28 14:55:37 +0300
commitb790b435daa3351067f80a5973b647f8d55367a2 (patch)
tree8293f3bb4ef729ea06326a8fe2c64a7a14ab213d
parentxz: Check the value of lzma_stream_flags.version in --list. (diff)
downloadxz-b790b435daa3351067f80a5973b647f8d55367a2.tar.xz
xz: Fix assertion related to posix_fadvise().
Input file can be a FIFO or something else that doesn't support posix_fadvise() so don't check the return value even with an assertion. Nothing bad happens if the call to posix_fadvise() fails.
-rw-r--r--src/xz/file_io.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/xz/file_io.c b/src/xz/file_io.c
index f9807a69..61b10f98 100644
--- a/src/xz/file_io.c
+++ b/src/xz/file_io.c
@@ -511,14 +511,8 @@ io_open_src_real(file_pair *pair)
#endif
#ifdef HAVE_POSIX_FADVISE
- const int fadvise_ret = posix_fadvise(
- pair->src_fd, 0, 0, POSIX_FADV_SEQUENTIAL);
-
- // It shouldn't fail, but if it does anyway, it doesn't matter.
- // Check it with an assertion so that if something gets messed
- // up in the future, it will get caught when debugging is enabled.
- assert(fadvise_ret == 0);
- (void)fadvise_ret;
+ // It will fail with some special files like FIFOs but that is fine.
+ (void)posix_fadvise(pair->src_fd, 0, 0, POSIX_FADV_SEQUENTIAL);
#endif
return false;