From 0a130d510dc5272dc2fc7bc5a116f0694c8bd2a9 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 28 Aug 2009 21:09:51 +0200 Subject: rpm2cpio: handle unseekable input correctly function old new delta data_skip 14 20 +6 seek_by_jump 67 72 +5 data_align 81 84 +3 seek_by_read 20 19 -1 skip_header 99 94 -5 rpm2cpio_main 183 177 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/3 up/down: 14/-12) Total: 2 bytes Signed-off-by: Denys Vlasenko --- archival/libunarchive/data_align.c | 2 +- archival/libunarchive/data_skip.c | 2 +- archival/libunarchive/seek_by_jump.c | 6 +++--- archival/libunarchive/seek_by_read.c | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'archival/libunarchive') diff --git a/archival/libunarchive/data_align.c b/archival/libunarchive/data_align.c index 9f2e8432f..0c8542bf5 100644 --- a/archival/libunarchive/data_align.c +++ b/archival/libunarchive/data_align.c @@ -10,6 +10,6 @@ void FAST_FUNC data_align(archive_handle_t *archive_handle, unsigned boundary) { unsigned skip_amount = (boundary - (archive_handle->offset % boundary)) % boundary; - archive_handle->seek(archive_handle, skip_amount); + archive_handle->seek(archive_handle->src_fd, skip_amount); archive_handle->offset += skip_amount; } diff --git a/archival/libunarchive/data_skip.c b/archival/libunarchive/data_skip.c index 438750fe5..06d3dced4 100644 --- a/archival/libunarchive/data_skip.c +++ b/archival/libunarchive/data_skip.c @@ -8,5 +8,5 @@ void FAST_FUNC data_skip(archive_handle_t *archive_handle) { - archive_handle->seek(archive_handle, archive_handle->file_header->size); + archive_handle->seek(archive_handle->src_fd, archive_handle->file_header->size); } diff --git a/archival/libunarchive/seek_by_jump.c b/archival/libunarchive/seek_by_jump.c index 0a259c963..7181cb3ce 100644 --- a/archival/libunarchive/seek_by_jump.c +++ b/archival/libunarchive/seek_by_jump.c @@ -6,13 +6,13 @@ #include "libbb.h" #include "unarchive.h" -void FAST_FUNC seek_by_jump(const archive_handle_t *archive_handle, unsigned amount) +void FAST_FUNC seek_by_jump(int fd, off_t amount) { if (amount - && lseek(archive_handle->src_fd, (off_t) amount, SEEK_CUR) == (off_t) -1 + && lseek(fd, amount, SEEK_CUR) == (off_t) -1 ) { if (errno == ESPIPE) - seek_by_read(archive_handle, amount); + seek_by_read(fd, amount); else bb_perror_msg_and_die("seek failure"); } diff --git a/archival/libunarchive/seek_by_read.c b/archival/libunarchive/seek_by_read.c index 2326a7512..af65e5d85 100644 --- a/archival/libunarchive/seek_by_read.c +++ b/archival/libunarchive/seek_by_read.c @@ -9,8 +9,8 @@ /* If we are reading through a pipe, or from stdin then we can't lseek, * we must read and discard the data to skip over it. */ -void FAST_FUNC seek_by_read(const archive_handle_t *archive_handle, unsigned jump_size) +void FAST_FUNC seek_by_read(int fd, off_t amount) { - if (jump_size) - bb_copyfd_exact_size(archive_handle->src_fd, -1, jump_size); + if (amount) + bb_copyfd_exact_size(fd, -1, amount); } -- cgit v1.2.3