blob: e03fb0caaf95ba8718825c0a9707196da412bc82 [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/*
"Robert P. J. Day"801ab142006-07-12 07:56:04 +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 McGrath237ae422002-11-03 14:05:15 +00006#include <stdio.h>
Glenn L McGrath7ca04f32002-09-25 02:47:48 +00007#include <stdlib.h>
Glenn L McGrath237ae422002-11-03 14:05:15 +00008#include <string.h>
Glenn L McGrath7ca04f32002-09-25 02:47:48 +00009#include "unarchive.h"
10#include "libbb.h"
Glenn L McGrath95ebf612001-10-25 14:18:08 +000011
Rob Landleydfba7412006-03-06 20:47:33 +000012ssize_t archive_xread_all_eof(archive_handle_t *archive_handle, unsigned char *buf, size_t count)
Glenn L McGrath95ebf612001-10-25 14:18:08 +000013{
Glenn L McGrath237ae422002-11-03 14:05:15 +000014 ssize_t size;
15
Rob Landley53437472006-07-16 08:14:35 +000016 size = full_read(archive_handle->src_fd, buf, count);
Glenn L McGrath237ae422002-11-03 14:05:15 +000017 if ((size != 0) && (size != count)) {
Mike Frysinger5c9ed9f2005-04-20 00:28:44 +000018 bb_perror_msg_and_die("Short read, read %ld of %ld", (long)size, (long)count);
Glenn L McGrath95ebf612001-10-25 14:18:08 +000019 }
Glenn L McGrath237ae422002-11-03 14:05:15 +000020 return(size);
Eric Andersen2276d832002-07-11 11:11:56 +000021}