blob: ad931a8de59ee3fa5f306751e3f077640d425755 [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
Bernhard Reutner-Fischerfa939aa2006-04-05 16:21:37 +00006#include "libbb.h"
Denys Vlasenko833d4e72010-11-03 02:38:31 +01007#include "archive.h"
Bernhard Reutner-Fischerfa939aa2006-04-05 16:21:37 +00008
Denis Vlasenko37188322008-02-16 13:20:56 +00009/* If we are reading through a pipe, or from stdin then we can't lseek,
Glenn L McGrathd09bcec2003-11-14 08:26:25 +000010 * we must read and discard the data to skip over it.
Glenn L McGrathd09bcec2003-11-14 08:26:25 +000011 */
Denys Vlasenko0a130d52009-08-28 21:09:51 +020012void FAST_FUNC seek_by_read(int fd, off_t amount)
Glenn L McGrath95ebf612001-10-25 14:18:08 +000013{
Denys Vlasenko0a130d52009-08-28 21:09:51 +020014 if (amount)
15 bb_copyfd_exact_size(fd, -1, amount);
Eric Andersen2276d832002-07-11 11:11:56 +000016}