copy_file_chunk uses streams now.
diff --git a/libbb/copy_file_chunk.c b/libbb/copy_file_chunk.c
index bf0b06e..e887cbe 100644
--- a/libbb/copy_file_chunk.c
+++ b/libbb/copy_file_chunk.c
@@ -32,24 +32,29 @@
 /*
  * Copy chunksize bytes between two file descriptors
  */
-int copy_file_chunk(int srcfd, int dstfd, off_t chunksize)
+extern int copy_file_chunk(FILE *src_file, FILE *dst_file, off_t chunksize)
 {
-        off_t size;
-        char buffer[BUFSIZ]; /* BUFSIZ is declared in stdio.h */
-
-        while (chunksize > 0) {
-                if (chunksize > BUFSIZ)
-                        size = BUFSIZ;
-                else
-                        size = chunksize;
-                if (full_write(dstfd, buffer, full_read(srcfd, buffer, size)) < size)
-                        return(FALSE);
-                chunksize -= size;
-        }
-        return (TRUE);
+	off_t size, amount_written;
+	char buffer[BUFSIZ]; /* BUFSIZ is declared in stdio.h */
+	
+	clearerr(src_file);
+	clearerr(dst_file);
+	while (chunksize > 0) {
+		if (chunksize > BUFSIZ) {
+			size = BUFSIZ;
+		} else {
+			size = chunksize;
+		}
+		amount_written = fwrite(buffer, 1, fread(buffer, 1, size, src_file), dst_file);
+		if (amount_written != size) {
+			error_msg("Couldnt write correct amount");
+			return(FALSE);
+		}
+		chunksize -= amount_written;
+	}
+	return (TRUE);
 }
 
-
 /* END CODE */
 /*
 Local Variables: