"Robert P. J. Day" | 63fc1a9 | 2006-07-02 19:47:05 +0000 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: */ |
Glenn L McGrath | 95ebf61 | 2001-10-25 14:18:08 +0000 | [diff] [blame] | 2 | /* |
"Robert P. J. Day" | 801ab14 | 2006-07-12 07:56:04 +0000 | [diff] [blame] | 3 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
Glenn L McGrath | 95ebf61 | 2001-10-25 14:18:08 +0000 | [diff] [blame] | 4 | */ |
| 5 | |
Glenn L McGrath | 237ae42 | 2002-11-03 14:05:15 +0000 | [diff] [blame] | 6 | #include <stdio.h> |
Glenn L McGrath | 7ca04f3 | 2002-09-25 02:47:48 +0000 | [diff] [blame] | 7 | #include <stdlib.h> |
Glenn L McGrath | 237ae42 | 2002-11-03 14:05:15 +0000 | [diff] [blame] | 8 | #include <string.h> |
Glenn L McGrath | 7ca04f3 | 2002-09-25 02:47:48 +0000 | [diff] [blame] | 9 | #include "unarchive.h" |
| 10 | #include "libbb.h" |
Glenn L McGrath | 95ebf61 | 2001-10-25 14:18:08 +0000 | [diff] [blame] | 11 | |
Rob Landley | dfba741 | 2006-03-06 20:47:33 +0000 | [diff] [blame] | 12 | ssize_t archive_xread_all_eof(archive_handle_t *archive_handle, unsigned char *buf, size_t count) |
Glenn L McGrath | 95ebf61 | 2001-10-25 14:18:08 +0000 | [diff] [blame] | 13 | { |
Glenn L McGrath | 237ae42 | 2002-11-03 14:05:15 +0000 | [diff] [blame] | 14 | ssize_t size; |
| 15 | |
Rob Landley | 5343747 | 2006-07-16 08:14:35 +0000 | [diff] [blame^] | 16 | size = full_read(archive_handle->src_fd, buf, count); |
Glenn L McGrath | 237ae42 | 2002-11-03 14:05:15 +0000 | [diff] [blame] | 17 | if ((size != 0) && (size != count)) { |
Mike Frysinger | 5c9ed9f | 2005-04-20 00:28:44 +0000 | [diff] [blame] | 18 | bb_perror_msg_and_die("Short read, read %ld of %ld", (long)size, (long)count); |
Glenn L McGrath | 95ebf61 | 2001-10-25 14:18:08 +0000 | [diff] [blame] | 19 | } |
Glenn L McGrath | 237ae42 | 2002-11-03 14:05:15 +0000 | [diff] [blame] | 20 | return(size); |
Eric Andersen | 2276d83 | 2002-07-11 11:11:56 +0000 | [diff] [blame] | 21 | } |