"Robert P. J. Day" | 63fc1a9 | 2006-07-02 19:47:05 +0000 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: */ |
Glenn L McGrath | 95ebf61 | 2001-10-25 14:18:08 +0000 | [diff] [blame] | 2 | /* |
Denys Vlasenko | 0ef64bd | 2010-08-16 20:14:46 +0200 | [diff] [blame] | 3 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. |
Glenn L McGrath | 95ebf61 | 2001-10-25 14:18:08 +0000 | [diff] [blame] | 4 | */ |
Glenn L McGrath | 237ae42 | 2002-11-03 14:05:15 +0000 | [diff] [blame] | 5 | #include "libbb.h" |
Denys Vlasenko | d184a72 | 2011-09-22 12:45:14 +0200 | [diff] [blame] | 6 | #include "bb_archive.h" |
Glenn L McGrath | 237ae42 | 2002-11-03 14:05:15 +0000 | [diff] [blame] | 7 | |
Denys Vlasenko | 0a130d5 | 2009-08-28 21:09:51 +0200 | [diff] [blame] | 8 | void FAST_FUNC seek_by_jump(int fd, off_t amount) |
Glenn L McGrath | 95ebf61 | 2001-10-25 14:18:08 +0000 | [diff] [blame] | 9 | { |
Denis Vlasenko | adc772a | 2008-07-20 17:10:43 +0000 | [diff] [blame] | 10 | if (amount |
Denys Vlasenko | 0a130d5 | 2009-08-28 21:09:51 +0200 | [diff] [blame] | 11 | && lseek(fd, amount, SEEK_CUR) == (off_t) -1 |
Denis Vlasenko | adc772a | 2008-07-20 17:10:43 +0000 | [diff] [blame] | 12 | ) { |
Denis Vlasenko | 1af00ed | 2008-04-05 02:44:30 +0000 | [diff] [blame] | 13 | if (errno == ESPIPE) |
Denys Vlasenko | 0a130d5 | 2009-08-28 21:09:51 +0200 | [diff] [blame] | 14 | seek_by_read(fd, amount); |
Denis Vlasenko | 1af00ed | 2008-04-05 02:44:30 +0000 | [diff] [blame] | 15 | else |
Denis Vlasenko | e1a0d48 | 2006-10-20 13:28:22 +0000 | [diff] [blame] | 16 | bb_perror_msg_and_die("seek failure"); |
Glenn L McGrath | 95ebf61 | 2001-10-25 14:18:08 +0000 | [diff] [blame] | 17 | } |
Eric Andersen | 2276d83 | 2002-07-11 11:11:56 +0000 | [diff] [blame] | 18 | } |