[Box Backup-commit] COMMIT r1040 - box/chris/general/lib/common

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Sun, 15 Oct 2006 14:44:49 +0100


Author: chris
Date: 2006-10-15 14:44:48 +0100 (Sun, 15 Oct 2006)
New Revision: 1040

Modified:
   box/chris/general/lib/common/FileStream.cpp
Log:
Properly handle broken pipe when using FileStream to read from a local
process, and the child quits. Report this as EOF rather than throwing.


Modified: box/chris/general/lib/common/FileStream.cpp
===================================================================
--- box/chris/general/lib/common/FileStream.cpp	2006-10-15 13:42:33 UTC (rev 1039)
+++ box/chris/general/lib/common/FileStream.cpp	2006-10-15 13:44:48 UTC (rev 1040)
@@ -137,8 +137,14 @@
 	{
 		r = numBytesRead;
 	}
+	else if (GetLastError() == ERROR_BROKEN_PIPE)
+	{
+		r = 0;
+	}
 	else
 	{
+		::syslog(LOG_ERR, "Failed to read from file: error %d",
+			GetLastError());
 		r = -1;
 	}
 #else