[Haiku-commits] r31000 - haiku/trunk/src/bin/coreutils/src

axeld at BerliOS axeld at mail.berlios.de
Tue Jun 9 22:25:21 CEST 2009


Author: axeld
Date: 2009-06-09 22:25:20 +0200 (Tue, 09 Jun 2009)
New Revision: 31000
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=31000&view=rev

Modified:
   haiku/trunk/src/bin/coreutils/src/copy.c
Log:
* This should recreate 0 byte attributes, and therefore fix bug #4015.


Modified: haiku/trunk/src/bin/coreutils/src/copy.c
===================================================================
--- haiku/trunk/src/bin/coreutils/src/copy.c	2009-06-09 18:18:54 UTC (rev 30999)
+++ haiku/trunk/src/bin/coreutils/src/copy.c	2009-06-09 20:25:20 UTC (rev 31000)
@@ -153,15 +153,17 @@
 		if (fs_stat_attr(fromFd, dirent->d_name, &info) != 0)
 			continue;
 
-		while (info.size > 0) {
+		while (info.size >= 0) {
 			ssize_t bytesRead, bytesWritten;
-			
-			bytesRead = fs_read_attr(fromFd, dirent->d_name, info.type, pos, buffer, sizeof(buffer));
-			if (bytesRead <= 0)
+
+			bytesRead = fs_read_attr(fromFd, dirent->d_name, info.type, pos,
+				buffer, sizeof(buffer));
+			if (bytesRead < 0)
 				break;
-			
-			bytesWritten = fs_write_attr(toFd, dirent->d_name, info.type, pos, buffer, bytesRead);
-			if (bytesWritten != bytesRead)
+
+			bytesWritten = fs_write_attr(toFd, dirent->d_name, info.type, pos,
+				buffer, bytesRead);
+			if (bytesWritten != bytesRead || bytesRead == 0)
 				break;
 
 			pos += bytesWritten;
@@ -189,7 +191,7 @@
 	}
 
 	result = copy_attributes(fromFd, toFd);
-	
+
 	close(fromFd);
 	close(toFd);
 




More information about the Haiku-commits mailing list