blob: 007f68c6d9b6b5e1281068498aedad71024d2d7f [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 McGrath7ca04f32002-09-25 02:47:48 +00006#include "unarchive.h"
7#include "libbb.h"
Glenn L McGrath95ebf612001-10-25 14:18:08 +00008
Denis Vlasenko92297942006-11-21 11:58:14 +00009ssize_t archive_xread_all_eof(archive_handle_t *archive_handle,
10 unsigned char *buf, size_t count)
Glenn L McGrath95ebf612001-10-25 14:18:08 +000011{
Glenn L McGrath237ae422002-11-03 14:05:15 +000012 ssize_t size;
13
Rob Landley53437472006-07-16 08:14:35 +000014 size = full_read(archive_handle->src_fd, buf, count);
Denis Vlasenko92297942006-11-21 11:58:14 +000015 if (size != 0 && size != count) {
16 bb_error_msg_and_die("short read: %u of %u",
17 (unsigned)size, (unsigned)count);
Glenn L McGrath95ebf612001-10-25 14:18:08 +000018 }
Denis Vlasenko92297942006-11-21 11:58:14 +000019 return size;
Eric Andersen2276d832002-07-11 11:11:56 +000020}