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

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Sun, 22 Apr 2007 21:47:24 +0100


Author: chris
Date: 2007-04-22 21:47:24 +0100 (Sun, 22 Apr 2007)
New Revision: 1576

Modified:
   box/chris/general/lib/server/ServerStream.h
Log:
The socket pointer is not really NULL at start, so make it NULL when we
ignore Unix sockets on Win32.


Modified: box/chris/general/lib/server/ServerStream.h
===================================================================
--- box/chris/general/lib/server/ServerStream.h	2007-04-22 20:46:51 UTC (rev 1575)
+++ box/chris/general/lib/server/ServerStream.h	2007-04-22 20:47:24 UTC (rev 1576)
@@ -171,18 +171,20 @@
 						else if(c[0] == "unix")
 						{
 							#ifdef WIN32
-							BOX_WARNING("Ignoring request to listen on a Unix socket on Windows: " << addrlist[a]);
+								BOX_WARNING("Ignoring request to listen on a Unix socket on Windows: " << addrlist[a]);
+								delete psocket;
+								psocket = NULL;
 							#else
-							// Check arguments size
-							if(c.size() != 2)
-							{
-								THROW_EXCEPTION(ServerException, ServerStreamBadListenAddrs)
-							}
+								// Check arguments size
+								if(c.size() != 2)
+								{
+									THROW_EXCEPTION(ServerException, ServerStreamBadListenAddrs)
+								}
 
-							// unlink anything there
-							::unlink(c[1].c_str());
-							
-							psocket->Listen(Socket::TypeUNIX, c[1].c_str());
+								// unlink anything there
+								::unlink(c[1].c_str());
+								
+								psocket->Listen(Socket::TypeUNIX, c[1].c_str());
 							#endif // WIN32
 						}
 						else