[Box Backup-commit] COMMIT r1303 - box/chris/general/lib/server

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Sat Mar 3 19:47:00 GMT 2007


Author: chris
Date: 2007-03-03 19:47:00 +0000 (Sat, 03 Mar 2007)
New Revision: 1303

Modified:
   box/chris/general/lib/server/ServerControl.h
Log:
Stricter tests for kill() success in HUPServer and KillServerInternal on 
Unix (merge with merge branch r1302)




Modified: box/chris/general/lib/server/ServerControl.h
===================================================================
--- box/chris/general/lib/server/ServerControl.h	2007-02-25 15:33:17 UTC (rev 1302)
+++ box/chris/general/lib/server/ServerControl.h	2007-03-03 19:47:00 UTC (rev 1303)
@@ -125,13 +125,13 @@
 inline bool HUPServer(int pid)
 {
 	if(pid == 0) return false;
-	return ::kill(pid, SIGHUP) != -1;
+	return ::kill(pid, SIGHUP) == 0;
 }
 
 inline bool KillServerInternal(int pid)
 {
 	if(pid == 0 || pid == -1) return false;
-	bool killed = (::kill(pid, SIGTERM) != -1);
+	bool killed = (::kill(pid, SIGTERM) == 0);
 	TEST_THAT(killed);
 	return killed;
 }
@@ -140,7 +140,10 @@
 
 inline bool KillServer(int pid)
 {
-	KillServerInternal(pid);
+	if (!KillServerInternal(pid))
+	{
+		return false;
+	}
 
 	for (int i = 0; i < 30; i++)
 	{




More information about the Boxbackup-commit mailing list