diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2019-06-24 01:24:17 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2019-06-24 01:24:17 +0300 |
commit | 4fd3a8dd0b60f029e1c66a0ee634f9e9fda3caa9 (patch) | |
tree | 7725cc2d0ae00c7149b6944fa72ceb5c4f65736a | |
parent | Tests: Remove a duplicate branch from tests/tests.h. (diff) | |
download | xz-4fd3a8dd0b60f029e1c66a0ee634f9e9fda3caa9.tar.xz |
xz: Cleanup io_seek_src() a bit.
lseek() returns -1 on error and checking for -1 is nicer.
-rw-r--r-- | src/xz/file_io.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/xz/file_io.c b/src/xz/file_io.c index 2d1f8a91..d86b36e7 100644 --- a/src/xz/file_io.c +++ b/src/xz/file_io.c @@ -1180,9 +1180,7 @@ io_seek_src(file_pair *pair, uint64_t pos) if (pos > (uint64_t)(pair->src_st.st_size)) message_bug(); - const off_t offset = (off_t)pos; - - if (lseek(pair->src_fd, offset, SEEK_SET) != offset) { + if (lseek(pair->src_fd, (off_t)(pos), SEEK_SET) == -1) { message_error(_("%s: Error seeking the file: %s"), pair->src_name, strerror(errno)); return true; |