blob: 4fcd99ac80e584d94f62d95208ccc483f3e5c651 [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 */
5
Glenn L McGrath237ae422002-11-03 14:05:15 +00006#include "libbb.h"
Denys Vlasenkod184a722011-09-22 12:45:14 +02007#include "bb_archive.h"
Glenn L McGrath237ae422002-11-03 14:05:15 +00008
Denys Vlasenko0a130d52009-08-28 21:09:51 +02009void FAST_FUNC seek_by_jump(int fd, off_t amount)
Glenn L McGrath95ebf612001-10-25 14:18:08 +000010{
Denis Vlasenkoadc772a2008-07-20 17:10:43 +000011 if (amount
Denys Vlasenko0a130d52009-08-28 21:09:51 +020012 && lseek(fd, amount, SEEK_CUR) == (off_t) -1
Denis Vlasenkoadc772a2008-07-20 17:10:43 +000013 ) {
Denis Vlasenko1af00ed2008-04-05 02:44:30 +000014 if (errno == ESPIPE)
Denys Vlasenko0a130d52009-08-28 21:09:51 +020015 seek_by_read(fd, 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}