blob: 8b5f3e88760c8700ab2966b1883e0e184234b30f [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 Vlasenko37188322008-02-16 13:20:56 +00009void seek_by_jump(const archive_handle_t *archive_handle, unsigned amount)
Glenn L McGrath95ebf612001-10-25 14:18:08 +000010{
Glenn L McGrath237ae422002-11-03 14:05:15 +000011 if (lseek(archive_handle->src_fd, (off_t) amount, SEEK_CUR) == (off_t) -1) {
Denis Vlasenkoe3241842007-08-13 10:36:25 +000012#if ENABLE_FEATURE_UNARCHIVE_TAPE
Glenn L McGrath237ae422002-11-03 14:05:15 +000013 if (errno == ESPIPE) {
Denis Vlasenko13858992006-10-08 12:49:22 +000014 seek_by_read(archive_handle, amount);
Glenn L McGrath237ae422002-11-03 14:05:15 +000015 } else
16#endif
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}