blob: 0a259c963bfe9ed63642673ed7d203e67656c3d4 [file] [log] [blame]
"Robert P. J. Day"63fc1a92006-07-02 19:47:05 +00001/* vi: set sw=4 ts=4: */
Glenn L McGrath95ebf612001-10-25 14:18:08 +00002/*
"Robert P. J. Day"801ab142006-07-12 07:56:04 +00003 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
Glenn L McGrath95ebf612001-10-25 14:18:08 +00004 */
5
Glenn L McGrath237ae422002-11-03 14:05:15 +00006#include "libbb.h"
7#include "unarchive.h"
8
Denis Vlasenkodefc1ea2008-06-27 02:52:20 +00009void FAST_FUNC seek_by_jump(const archive_handle_t *archive_handle, unsigned amount)
Glenn L McGrath95ebf612001-10-25 14:18:08 +000010{
Denis Vlasenkoadc772a2008-07-20 17:10:43 +000011 if (amount
12 && lseek(archive_handle->src_fd, (off_t) amount, SEEK_CUR) == (off_t) -1
13 ) {
Denis Vlasenko1af00ed2008-04-05 02:44:30 +000014 if (errno == ESPIPE)
Denis Vlasenko13858992006-10-08 12:49:22 +000015 seek_by_read(archive_handle, amount);
Denis Vlasenko1af00ed2008-04-05 02:44:30 +000016 else
Denis Vlasenkoe1a0d482006-10-20 13:28:22 +000017 bb_perror_msg_and_die("seek failure");
Glenn L McGrath95ebf612001-10-25 14:18:08 +000018 }
Eric Andersen2276d832002-07-11 11:11:56 +000019}