archive_xread_all_eof.c 469 B

1234567891011121314151617181920
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  4. */
  5. #include "libbb.h"
  6. #include "unarchive.h"
  7. ssize_t archive_xread_all_eof(archive_handle_t *archive_handle,
  8. unsigned char *buf, size_t count)
  9. {
  10. ssize_t size;
  11. size = full_read(archive_handle->src_fd, buf, count);
  12. if (size != 0 && size != count) {
  13. bb_error_msg_and_die("short read: %u of %u",
  14. (unsigned)size, (unsigned)count);
  15. }
  16. return size;
  17. }