blob: 231360fa32cdbdff7f598c0a722e63f96eb7a1bd [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 McGrath7ca04f32002-09-25 02:47:48 +00006#include <sys/types.h>
Glenn L McGrath95ebf612001-10-25 14:18:08 +00007#include <errno.h>
Glenn L McGrath7134d652001-10-27 13:14:52 +00008#include <unistd.h>
Glenn L McGrath7ca04f32002-09-25 02:47:48 +00009#include <stdlib.h>
Glenn L McGrath95ebf612001-10-25 14:18:08 +000010
Glenn L McGrath237ae422002-11-03 14:05:15 +000011#include "libbb.h"
12#include "unarchive.h"
13
Rob Landleydfba7412006-03-06 20:47:33 +000014void seek_by_jump(const archive_handle_t *archive_handle, const unsigned int amount)
Glenn L McGrath95ebf612001-10-25 14:18:08 +000015{
Glenn L McGrath237ae422002-11-03 14:05:15 +000016 if (lseek(archive_handle->src_fd, (off_t) amount, SEEK_CUR) == (off_t) -1) {
Glenn L McGrath57033412002-11-08 08:07:38 +000017#ifdef CONFIG_FEATURE_UNARCHIVE_TAPE
Glenn L McGrath237ae422002-11-03 14:05:15 +000018 if (errno == ESPIPE) {
19 seek_by_char(archive_handle, amount);
20 } else
21#endif
Manuel Novoa III cad53642003-03-19 09:13:01 +000022 bb_perror_msg_and_die("Seek failure");
Glenn L McGrath95ebf612001-10-25 14:18:08 +000023 }
Eric Andersen2276d832002-07-11 11:11:56 +000024}