"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 | */ |
| 5 | |
Bernhard Reutner-Fischer | fa939aa | 2006-04-05 16:21:37 +0000 | [diff] [blame] | 6 | #include "libbb.h" |
Denys Vlasenko | 833d4e7 | 2010-11-03 02:38:31 +0100 | [diff] [blame] | 7 | #include "archive.h" |
Bernhard Reutner-Fischer | fa939aa | 2006-04-05 16:21:37 +0000 | [diff] [blame] | 8 | |
Denis Vlasenko | 3718832 | 2008-02-16 13:20:56 +0000 | [diff] [blame] | 9 | /* If we are reading through a pipe, or from stdin then we can't lseek, |
Glenn L McGrath | d09bcec | 2003-11-14 08:26:25 +0000 | [diff] [blame] | 10 | * we must read and discard the data to skip over it. |
Glenn L McGrath | d09bcec | 2003-11-14 08:26:25 +0000 | [diff] [blame] | 11 | */ |
Denys Vlasenko | 0a130d5 | 2009-08-28 21:09:51 +0200 | [diff] [blame] | 12 | void FAST_FUNC seek_by_read(int fd, off_t amount) |
Glenn L McGrath | 95ebf61 | 2001-10-25 14:18:08 +0000 | [diff] [blame] | 13 | { |
Denys Vlasenko | 0a130d5 | 2009-08-28 21:09:51 +0200 | [diff] [blame] | 14 | if (amount) |
| 15 | bb_copyfd_exact_size(fd, -1, amount); |
Eric Andersen | 2276d83 | 2002-07-11 11:11:56 +0000 | [diff] [blame] | 16 | } |