blob: 03cbb9ecc051b3948715044933e5a824d60bba19 [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/*
Bernhard Reutner-Fischerfa939aa2006-04-05 16:21:37 +00003 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
Glenn L McGrath95ebf612001-10-25 14:18:08 +00004 */
5
Glenn L McGrathd09bcec2003-11-14 08:26:25 +00006#include <stdlib.h>
Glenn L McGrath95ebf612001-10-25 14:18:08 +00007
Glenn L McGrathd09bcec2003-11-14 08:26:25 +00008#include "unarchive.h"
Bernhard Reutner-Fischerfa939aa2006-04-05 16:21:37 +00009#include "libbb.h"
10
Denis Vlasenko13858992006-10-08 12:49:22 +000011/* If we are reading through a pipe(), or from stdin then we cant lseek,
Glenn L McGrathd09bcec2003-11-14 08:26:25 +000012 * we must read and discard the data to skip over it.
Glenn L McGrathd09bcec2003-11-14 08:26:25 +000013 */
Denis Vlasenko13858992006-10-08 12:49:22 +000014void seek_by_read(const archive_handle_t *archive_handle, const unsigned int jump_size)
Glenn L McGrath95ebf612001-10-25 14:18:08 +000015{
Glenn L McGrath7ffe1332003-11-21 22:24:57 +000016 if (jump_size) {
Glenn L McGrath15c35122004-02-21 09:20:56 +000017 bb_copyfd_size(archive_handle->src_fd, -1, jump_size);
Glenn L McGrath95ebf612001-10-25 14:18:08 +000018 }
Eric Andersen2276d832002-07-11 11:11:56 +000019}