blob: 232d97e53698bd6f5eff09e64fa9327f37cb5929 [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/*
Denys Vlasenko0ef64bd2010-08-16 20:14:46 +02003 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
Glenn L McGrath95ebf612001-10-25 14:18:08 +00004 */
Glenn L McGrath237ae422002-11-03 14:05:15 +00005#include "libbb.h"
Denys Vlasenkod184a722011-09-22 12:45:14 +02006#include "bb_archive.h"
Glenn L McGrath237ae422002-11-03 14:05:15 +00007
Denys Vlasenko0a130d52009-08-28 21:09:51 +02008void FAST_FUNC seek_by_jump(int fd, off_t amount)
Glenn L McGrath95ebf612001-10-25 14:18:08 +00009{
Denis Vlasenkoadc772a2008-07-20 17:10:43 +000010 if (amount
Denys Vlasenko0a130d52009-08-28 21:09:51 +020011 && lseek(fd, amount, SEEK_CUR) == (off_t) -1
Denis Vlasenkoadc772a2008-07-20 17:10:43 +000012 ) {
Denis Vlasenko1af00ed2008-04-05 02:44:30 +000013 if (errno == ESPIPE)
Denys Vlasenko0a130d52009-08-28 21:09:51 +020014 seek_by_read(fd, amount);
Denis Vlasenko1af00ed2008-04-05 02:44:30 +000015 else
Denis Vlasenkoe1a0d482006-10-20 13:28:22 +000016 bb_perror_msg_and_die("seek failure");
Glenn L McGrath95ebf612001-10-25 14:18:08 +000017 }
Eric Andersen2276d832002-07-11 11:11:56 +000018}