If lseek fails to seek to correct position, e.g. because the descriptor
is in append mode, do not use errno because it's not set.
In such a case, fall back to ARCHIVE_ERRNO_MISC.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
actual_offset = lseek(fd,
target_offset - actual_offset, SEEK_CUR);
if (actual_offset != target_offset) {
- archive_set_error(a, errno, "Seek error");
+ archive_set_error(a,
+ actual_offset == -1 ? errno : ARCHIVE_ERRNO_MISC,
+ "Seek error");
return (ARCHIVE_FATAL);
}
return (ARCHIVE_OK);