mirror of https://git.tukaani.org/xz.git
xz: Cleanup io_seek_src() a bit.
lseek() returns -1 on error and checking for -1 is nicer.
This commit is contained in:
parent
dfda7cf6af
commit
4fd3a8dd0b
|
@ -1180,9 +1180,7 @@ io_seek_src(file_pair *pair, uint64_t pos)
|
||||||
if (pos > (uint64_t)(pair->src_st.st_size))
|
if (pos > (uint64_t)(pair->src_st.st_size))
|
||||||
message_bug();
|
message_bug();
|
||||||
|
|
||||||
const off_t offset = (off_t)pos;
|
if (lseek(pair->src_fd, (off_t)(pos), SEEK_SET) == -1) {
|
||||||
|
|
||||||
if (lseek(pair->src_fd, offset, SEEK_SET) != offset) {
|
|
||||||
message_error(_("%s: Error seeking the file: %s"),
|
message_error(_("%s: Error seeking the file: %s"),
|
||||||
pair->src_name, strerror(errno));
|
pair->src_name, strerror(errno));
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue