diff options
Diffstat (limited to 'archival/libunarchive/seek_sub_file.c')
-rw-r--r-- | archival/libunarchive/seek_sub_file.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/archival/libunarchive/seek_sub_file.c b/archival/libunarchive/seek_sub_file.c index 7523a52..733bb36 100644 --- a/archival/libunarchive/seek_sub_file.c +++ b/archival/libunarchive/seek_sub_file.c @@ -14,23 +14,19 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <stdio.h> +#include <sys/types.h> #include <errno.h> -#include <stdlib.h> #include <unistd.h> +#include <stdlib.h> +#include "unarchive.h" +#include "libbb.h" -off_t archive_offset; - -void seek_sub_file(FILE *src_stream, const int count) +extern void seek_sub_file(const int src_fd, const unsigned int amount) { - /* Try to fseek as faster */ - archive_offset += count; - if (fseek(src_stream, count, SEEK_CUR) != 0 && errno == ESPIPE) { - int i; - for (i = 0; i < count; i++) { - fgetc(src_stream); + if ((lseek(src_fd, amount, SEEK_CUR) == -1) && (errno == ESPIPE)) { + unsigned int i; + for (i = 0; i < amount; i++) { + xread_char(src_fd); } } - return; } - |