"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 | /* |
"Robert P. J. Day" | 801ab14 | 2006-07-12 07:56:04 +0000 | [diff] [blame] | 3 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
Glenn L McGrath | 95ebf61 | 2001-10-25 14:18:08 +0000 | [diff] [blame] | 4 | */ |
| 5 | |
Glenn L McGrath | 237ae42 | 2002-11-03 14:05:15 +0000 | [diff] [blame] | 6 | #include "libbb.h" |
| 7 | #include "unarchive.h" |
| 8 | |
Rob Landley | dfba741 | 2006-03-06 20:47:33 +0000 | [diff] [blame] | 9 | void seek_by_jump(const archive_handle_t *archive_handle, const unsigned int amount) |
Glenn L McGrath | 95ebf61 | 2001-10-25 14:18:08 +0000 | [diff] [blame] | 10 | { |
Glenn L McGrath | 237ae42 | 2002-11-03 14:05:15 +0000 | [diff] [blame] | 11 | if (lseek(archive_handle->src_fd, (off_t) amount, SEEK_CUR) == (off_t) -1) { |
Denis Vlasenko | e324184 | 2007-08-13 10:36:25 +0000 | [diff] [blame^] | 12 | #if ENABLE_FEATURE_UNARCHIVE_TAPE |
Glenn L McGrath | 237ae42 | 2002-11-03 14:05:15 +0000 | [diff] [blame] | 13 | if (errno == ESPIPE) { |
Denis Vlasenko | 1385899 | 2006-10-08 12:49:22 +0000 | [diff] [blame] | 14 | seek_by_read(archive_handle, amount); |
Glenn L McGrath | 237ae42 | 2002-11-03 14:05:15 +0000 | [diff] [blame] | 15 | } else |
| 16 | #endif |
Denis Vlasenko | e1a0d48 | 2006-10-20 13:28:22 +0000 | [diff] [blame] | 17 | bb_perror_msg_and_die("seek failure"); |
Glenn L McGrath | 95ebf61 | 2001-10-25 14:18:08 +0000 | [diff] [blame] | 18 | } |
Eric Andersen | 2276d83 | 2002-07-11 11:11:56 +0000 | [diff] [blame] | 19 | } |