summaryrefslogtreecommitdiff
path: root/archival/libunarchive/copy_file_chunk_fd.c
diff options
context:
space:
mode:
authorGlenn L McGrath2002-11-03 14:05:15 +0000
committerGlenn L McGrath2002-11-03 14:05:15 +0000
commit237ae42fc96ede945d28d9054f045b73e419d089 (patch)
tree3fb6a9c10150303aca3c218b47aaf327a186382a /archival/libunarchive/copy_file_chunk_fd.c
parent2fc54a9258c3aa5dad2ce9807ba85cf29af2668e (diff)
downloadbusybox-237ae42fc96ede945d28d9054f045b73e419d089.zip
busybox-237ae42fc96ede945d28d9054f045b73e419d089.tar.gz
Abstract read and seek in unarchiving code, convert bunzip to file descriptors, support tar -j
Diffstat (limited to 'archival/libunarchive/copy_file_chunk_fd.c')
-rw-r--r--archival/libunarchive/copy_file_chunk_fd.c33
1 files changed, 0 insertions, 33 deletions
diff --git a/archival/libunarchive/copy_file_chunk_fd.c b/archival/libunarchive/copy_file_chunk_fd.c
deleted file mode 100644
index fb513e6..0000000
--- a/archival/libunarchive/copy_file_chunk_fd.c
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <unistd.h>
-#include <sys/types.h>
-#include "libbb.h"
-
-/* Copy CHUNKSIZE bytes (or untill EOF if chunksize == -1)
- * from SRC_FILE to DST_FILE. */
-extern int copy_file_chunk_fd(int src_fd, int dst_fd, off_t chunksize)
-{
- size_t nread, size;
- char buffer[BUFSIZ];
-
- while (chunksize != 0) {
- if (chunksize > BUFSIZ) {
- size = BUFSIZ;
- } else {
- size = chunksize;
- }
- nread = xread(src_fd, buffer, size);
- if (nread == 0) {
- return 1;
- }
-
- if (write (dst_fd, buffer, nread) != nread) {
- error_msg_and_die ("Short write");
- }
-
- if (chunksize != -1) {
- chunksize -= nread;
- }
- }
-
- return 0;
-}