From: Tobias Stoeckmann Date: Sun, 7 Jun 2026 14:44:36 +0000 (+0200) Subject: read_data_into_fd: Print correct error code X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ffbc3a0a1e2f5f391f1374c8ca8280fa73ff218;p=thirdparty%2Flibarchive.git read_data_into_fd: Print correct error code 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 --- diff --git a/libarchive/archive_read_data_into_fd.c b/libarchive/archive_read_data_into_fd.c index 8fd5e1244..8d56d7042 100644 --- a/libarchive/archive_read_data_into_fd.c +++ b/libarchive/archive_read_data_into_fd.c @@ -56,7 +56,9 @@ pad_to(struct archive *a, int fd, int can_lseek, 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);