[Box Backup-commit] COMMIT r3600 - box/trunk/lib/server

subversion at boxbackup.org subversion at boxbackup.org
Fri Jul 31 07:41:01 BST 2015


Author: chris
Date: 2015-07-31 06:41:01 +0000 (Fri, 31 Jul 2015)
New Revision: 3600

Modified:
   box/trunk/lib/server/ServerStream.h
Log:
Fix ServerStream logging too many messages when waiting for a child to die.

Detect that there are no remaining children to wait for, and return quietly.

Modified: box/trunk/lib/server/ServerStream.h
===================================================================
--- box/trunk/lib/server/ServerStream.h	2015-07-31 06:40:51 UTC (rev 3599)
+++ box/trunk/lib/server/ServerStream.h	2015-07-31 06:41:01 UTC (rev 3600)
@@ -17,6 +17,7 @@
 	#include <sys/wait.h>
 #endif
 
+#include "autogen_ServerException.h"
 #include "Daemon.h"
 #include "SocketListen.h"
 #include "Utils.h"
@@ -344,10 +345,20 @@
 			p = ::waitpid(0 /* any child in process group */,
 				&status, WNOHANG);
 
-			if(p == -1 && errno != ECHILD && errno != EINTR)
+			if(p == -1)
 			{
-				THROW_EXCEPTION(ServerException,
-					ServerWaitOnChildError)
+				if (errno == ECHILD || errno == EINTR)
+				{
+					// Nothing actually happened, so there's no reason
+					// to wait again.
+					break;
+				}
+				else
+				{
+					THROW_SYS_ERROR("Failed to wait for daemon child "
+						"process", ServerException,
+						ServerWaitOnChildError);
+				}
 			}
 			else if(p == 0)
 			{




More information about the Boxbackup-commit mailing list