svn commit: trunk/busybox/libbb

landley at busybox.net landley at busybox.net
Sat Nov 12 11:04:15 UTC 2005


Author: landley
Date: 2005-11-12 03:04:11 -0800 (Sat, 12 Nov 2005)
New Revision: 12225

Log:
My last change to this file broke tar x.  Sigh.  (Trying to make sure we work
on file sizes between 2 and 4 gigs on 32 bit machines.  For supporting >4 gigs,
just use a 64 bit machine already...)


Modified:
   trunk/busybox/libbb/copyfd.c


Changeset:
Modified: trunk/busybox/libbb/copyfd.c
===================================================================
--- trunk/busybox/libbb/copyfd.c	2005-11-12 02:54:06 UTC (rev 12224)
+++ trunk/busybox/libbb/copyfd.c	2005-11-12 11:04:11 UTC (rev 12225)
@@ -29,11 +29,13 @@
 	RESERVE_CONFIG_BUFFER(buffer,BUFSIZ);
 
 	if (src_fd < 0) goto out;
-
 	while (!size || total < size)
 	{
-		ssize_t wrote, xread = (size && size < BUFSIZ) ? size : BUFSIZ;
-		xread = safe_read(src_fd, buffer, xread);
+		ssize_t wrote, xread;
+		
+		xread = safe_read(src_fd, buffer,
+				(!size || size - total > BUFSIZ) ? BUFSIZ : size - total);
+
 		if (xread > 0) {
 			/* A -1 dst_fd means we need to fake it... */
 			wrote = (dst_fd < 0) ? xread : bb_full_write(dst_fd, buffer, xread);
@@ -42,7 +44,6 @@
 				break;
 			}
 			total += wrote;
-			size -= wrote;
 		} else if (xread < 0) {
 			bb_perror_msg(bb_msg_read_error);
 			break;




More information about the busybox-cvs mailing list