[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b

aCaB acab at clamav.net
Sun Apr 4 01:18:13 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit 288b945f57de3b95dd8df01060a201629d4e940b
Author: aCaB <acab at clamav.net>
Date:   Sat Jan 30 03:17:52 2010 +0100

    clamd-win32 - where is my mind?

diff --git a/clamd/others.c b/clamd/others.c
index 0529704..7d2e2aa 100644
--- a/clamd/others.c
+++ b/clamd/others.c
@@ -431,7 +431,7 @@ void fds_remove(struct fd_data *data, int fd)
  * Must be called with buf_mutex lock held.
  */
 /* TODO: handle ReadTimeout */
-int fds_poll_recv(struct fd_data *data, int timeout, int check_signals, void *dummy)
+int fds_poll_recv(struct fd_data *data, int timeout, int check_signals, void *event)
 {
     unsigned fdsok = data->nfds;
     size_t i;
@@ -498,7 +498,7 @@ int fds_poll_recv(struct fd_data *data, int timeout, int check_signals, void *du
 
 	fds_unlock(data);
 #ifdef _WIN32
-	retval = poll_with_event(data->poll_data, n, timeout, dummy);
+	retval = poll_with_event(data->poll_data, n, timeout, event);
 #else
 	retval = poll(data->poll_data, n, timeout);
 #endif
diff --git a/clamd/others.h b/clamd/others.h
index 828f7df..c16f611 100644
--- a/clamd/others.h
+++ b/clamd/others.h
@@ -79,7 +79,7 @@ int writen(int fd, void *buff, unsigned int count);
 int fds_add(struct fd_data *data, int fd, int listen_only, int timeout);
 void fds_remove(struct fd_data *data, int fd);
 void fds_cleanup(struct fd_data *data);
-int fds_poll_recv(struct fd_data *data, int timeout, int check_signals, void *dummy);
+int fds_poll_recv(struct fd_data *data, int timeout, int check_signals, void *event);
 void fds_free(struct fd_data *data);
 
 #endif
diff --git a/clamd/server-th.c b/clamd/server-th.c
index 3d24cba..4a0ca97 100644
--- a/clamd/server-th.c
+++ b/clamd/server-th.c
@@ -69,8 +69,10 @@ pthread_mutex_t reload_mutex = PTHREAD_MUTEX_INITIALIZER;
 int sighup = 0;
 static struct cl_stat dbstat;
 
-static void *event_wake_recv  = NULL;
-static void *event_wake_accept = NULL;
+#ifdef _WIN32
+HANDLE event_wake_recv;
+HANDLE event_wake_accept;
+#endif
 
 static void scanner_thread(void *arg)
 {
@@ -1092,6 +1094,7 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi
     time(&start_time);
     for(;;) {
 	int new_sd;
+
 	/* Block waiting for connection on any of the sockets */
 	pthread_mutex_lock(fds->buf_mutex);
 	fds_cleanup(fds);
@@ -1099,12 +1102,10 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi
 	if (fds->nfds <= (unsigned)max_queue)
 	    pthread_cond_signal(&acceptdata.cond_nfds);
 	new_sd = fds_poll_recv(fds, selfchk ? (int)selfchk : -1, 1, event_wake_recv);
-
 #ifdef _WIN32
 	ResetEvent(event_wake_recv);
 #else
 	if (!fds->nfds) {
-	    continue;
 	    /* at least the dummy/sync pipe should have remained */
 	    logg("!All recv() descriptors gone: fatal\n");
 	    pthread_mutex_lock(&exit_mutex);
@@ -1114,7 +1115,6 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi
 	    break;
 	}
 #endif
-
 	if (new_sd == -1 && errno != EINTR) {
 	    logg("!Failed to poll sockets, fatal\n");
 	    pthread_mutex_lock(&exit_mutex);
@@ -1131,7 +1131,7 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi
 	    if (!buf->got_newdata)
 		continue;
 
-#ifndef _WIN32
+#ifndef _WIN32 //FIXME
 	    if (buf->fd == acceptdata.syncpipe_wake_recv[0]) {
 		/* dummy sync pipe, just to wake us */
 		if (read(buf->fd, buff, sizeof(buff)) < 0) {
diff --git a/win32/clamav-config.h b/win32/clamav-config.h
index e60a5ae..cbbeccd 100644
--- a/win32/clamav-config.h
+++ b/win32/clamav-config.h
@@ -493,7 +493,7 @@
 /* #undef USE_SYSLOG */
 
 /* Version number of package */
-#define VERSION "devel-r5076-715-gd29df4c"
+#define VERSION "devel-r5076-706-g0380088"
 
 /* Version suffix for package */
 #define VERSION_SUFFIX ""
diff --git a/win32/clamd.vcproj b/win32/clamd.vcproj
index c332f45..c246e84 100644
--- a/win32/clamd.vcproj
+++ b/win32/clamd.vcproj
@@ -1,251 +1,251 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	Keyword="Win32Proj"
-	Name="clamd"
-	ProjectGUID="{B3CA73CF-E71E-42F3-95DE-43797A86C798}"
-	ProjectType="Visual C++"
-	RootNamespace="clamd"
-	TargetFrameworkVersion="196613"
-	Version="9,00"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			CharacterSet="2"
-			ConfigurationType="1"
-			IntermediateDirectory="$(SolutionDir)build\$(ProjectName)\$(ConfigurationName)"
-			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				AdditionalIncludeDirectories="&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)..\libclamav&quot;;&quot;$(SolutionDir)compat&quot;;&quot;$(SolutionDir)3rdparty\zlib&quot;;&quot;$(SolutionDir)3rdparty\pthreads&quot;;&quot;$(SolutionDir)3rdparty\bzip2&quot;;&quot;$(SolutionDir)..&quot;"
-				BasicRuntimeChecks="3"
-				CompileAs="1"
-				DebugInformationFormat="3"
-				DisableSpecificWarnings="4996;4244;4090;4018"
-				MinimalRebuild="true"
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="WIN32_LEAN_AND_MEAN;HAVE_CONFIG_H;_BIND_TO_CURRENT_VCLIBS_VERSION=1"
-				RuntimeLibrary="3"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				GenerateDebugInformation="true"
-				LinkIncremental="1"
-				Name="VCLinkerTool"
-				SubSystem="1"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			CharacterSet="2"
-			ConfigurationType="1"
-			IntermediateDirectory="$(SolutionDir)build\$(ProjectName)\$(ConfigurationName)"
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				AdditionalIncludeDirectories="&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)..\libclamav&quot;;&quot;$(SolutionDir)compat&quot;;&quot;$(SolutionDir)3rdparty\zlib&quot;;&quot;$(SolutionDir)3rdparty\pthreads&quot;;&quot;$(SolutionDir)3rdparty\bzip2&quot;;&quot;$(SolutionDir)..&quot;"
-				CompileAs="1"
-				DebugInformationFormat="3"
-				DisableSpecificWarnings="4996;4244;4090;4018"
-				EnableFunctionLevelLinking="true"
-				EnableIntrinsicFunctions="true"
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				PreprocessorDefinitions="WIN32_LEAN_AND_MEAN;HAVE_CONFIG_H;_BIND_TO_CURRENT_VCLIBS_VERSION=1"
-				RuntimeLibrary="2"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				EnableCOMDATFolding="2"
-				GenerateDebugInformation="true"
-				LinkIncremental="1"
-				Name="VCLinkerTool"
-				OptimizeReferences="2"
-				SubSystem="1"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			Name="Source Files"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<File
-				RelativePath="..\clamd\clamd.c"
-				>
-			</File>
-			<File
-				RelativePath="..\clamd\localserver.c"
-				>
-			</File>
-			<File
-				RelativePath="..\clamd\others.c"
-				>
-			</File>
-			<File
-				RelativePath="..\clamd\scanner.c"
-				>
-			</File>
-			<File
-				RelativePath="..\clamd\server-th.c"
-				>
-			</File>
-			<File
-				RelativePath="..\clamd\session.c"
-				>
-			</File>
-			<File
-				RelativePath="..\clamd\tcpserver.c"
-				>
-			</File>
-			<File
-				RelativePath="..\clamd\thrmgr.c"
-				>
-			</File>
-			<Filter
-				Name="shared"
-				>
-				<File
-					RelativePath="..\shared\misc.c"
-					>
-				</File>
-				<File
-					RelativePath="..\shared\output.c"
-					>
-				</File>
-			</Filter>
-			<Filter
-				Name="compat"
-				>
-				<File
-					RelativePath=".\compat\libgen.c"
-					>
-				</File>
-				<File
-					RelativePath=".\compat\setargv.c"
-					>
-				</File>
-			</Filter>
-		</Filter>
-		<Filter
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			Name="Header Files"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-		</Filter>
-		<Filter
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
-			Name="Resource Files"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9,00"
+	Name="clamd"
+	ProjectGUID="{B3CA73CF-E71E-42F3-95DE-43797A86C798}"
+	RootNamespace="clamd"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(SolutionDir)build\$(ProjectName)\$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)..\libclamav&quot;;&quot;$(SolutionDir)compat&quot;;&quot;$(SolutionDir)3rdparty\zlib&quot;;&quot;$(SolutionDir)3rdparty\pthreads&quot;;&quot;$(SolutionDir)3rdparty\bzip2&quot;;&quot;$(SolutionDir)..&quot;"
+				PreprocessorDefinitions="WIN32_LEAN_AND_MEAN;HAVE_CONFIG_H;_BIND_TO_CURRENT_VCLIBS_VERSION=1"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4996;4244;4090;4018"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(SolutionDir)build\$(ProjectName)\$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)..\libclamav&quot;;&quot;$(SolutionDir)compat&quot;;&quot;$(SolutionDir)3rdparty\zlib&quot;;&quot;$(SolutionDir)3rdparty\pthreads&quot;;&quot;$(SolutionDir)3rdparty\bzip2&quot;;&quot;$(SolutionDir)..&quot;"
+				PreprocessorDefinitions="WIN32_LEAN_AND_MEAN;HAVE_CONFIG_H;_BIND_TO_CURRENT_VCLIBS_VERSION=1"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4996;4244;4090;4018"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\clamd\clamd.c"
+				>
+			</File>
+			<File
+				RelativePath="..\clamd\localserver.c"
+				>
+			</File>
+			<File
+				RelativePath="..\clamd\others.c"
+				>
+			</File>
+			<File
+				RelativePath="..\clamd\scanner.c"
+				>
+			</File>
+			<File
+				RelativePath="..\clamd\server-th.c"
+				>
+			</File>
+			<File
+				RelativePath="..\clamd\session.c"
+				>
+			</File>
+			<File
+				RelativePath="..\clamd\tcpserver.c"
+				>
+			</File>
+			<File
+				RelativePath="..\clamd\thrmgr.c"
+				>
+			</File>
+			<Filter
+				Name="shared"
+				>
+				<File
+					RelativePath="..\shared\misc.c"
+					>
+				</File>
+				<File
+					RelativePath="..\shared\output.c"
+					>
+				</File>
+			</Filter>
+			<Filter
+				Name="compat"
+				>
+				<File
+					RelativePath=".\compat\libgen.c"
+					>
+				</File>
+				<File
+					RelativePath=".\compat\setargv.c"
+					>
+				</File>
+			</Filter>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/win32/compat/net.c b/win32/compat/net.c
index f119bed..8458b3a 100644
--- a/win32/compat/net.c
+++ b/win32/compat/net.c
@@ -326,13 +326,12 @@ int w32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, s
     return ret;
 }
 
-int w32_accept(int sockfd, const struct sockaddr *addr, socklen_t *addrlen) {
-    SOCKET s;
-    if((s = accept((SOCKET)sockfd, addr, addrlen))==INVALID_SOCKET) {
+int w32_accept(SOCKET sockfd, const struct sockaddr *addr, socklen_t *addrlen) {
+    if((sockfd = accept(sockfd, addr, addrlen)) == INVALID_SOCKET) {
 	wsock2errno();
 	return -1;
     }
-    return (int)s;
+    return (int)sockfd;
 }
 
 int w32_listen(int sockfd, int backlog) {
@@ -359,20 +358,32 @@ struct w32polldata {
     struct pollfd *polldata;
 };
 
-static VOID CALLBACK poll_cb(PVOID param, BOOLEAN timedout) {
+VOID CALLBACK poll_cb(PVOID param, BOOLEAN timedout) {
     WSANETWORKEVENTS evt;
     struct w32polldata *item = (struct w32polldata *)param;
     if(!timedout) {
 	unsigned int i;
 	WSAEnumNetworkEvents(item->polldata->fd, item->event, &evt);
-	for(i=0; i<evt.lNetworkEvents; i++) {
-	    if(evt.iErrorCode[i] & (FD_ACCEPT|FD_READ)) item->polldata->revents |= POLLIN;
-	    if(evt.iErrorCode[i] & FD_CLOSE) item->polldata->revents |= POLLHUP;
-	}
-	if(SetEvent(item->setme)==0) {
-	    int a = GetLastError();
-	    a++;
+	switch(evt.lNetworkEvents) {
+	    case FD_ACCEPT:
+		i = FD_ACCEPT_BIT;
+		item->polldata->revents = POLLIN;
+		break;
+	    case FD_READ:
+		i = FD_READ_BIT;
+		item->polldata->revents = POLLIN;
+		break;
+	    case FD_CLOSE:
+		i = FD_CLOSE_BIT;
+		item->polldata->revents = POLLHUP;
+		break;
+	    default:
+		i = -1;
+		item->polldata->revents = POLLERR;
 	}
+	if(i>=0 && evt.iErrorCode[i])
+	    item->polldata->revents = POLLERR;
+	SetEvent(item->setme);
     }
 }
 
@@ -381,17 +392,18 @@ int poll_with_event(struct pollfd *fds, int nfds, int timeout, HANDLE event) {
     struct w32polldata *items;
     unsigned int i, ret = 0;
 
-    setme = malloc(2 * sizeof(HANDLE));
-    setme[0] = CreateEvent(NULL, TRUE, FALSE, NULL);
-    setme[1] = event;
-    timeout = timeout>=0 ? timeout*1000 : INFINITE;
+    if(timeout <0) timeout = INFINITE;
     if(!nfds) {
-	if(event)
-	    WaitForSingleObject(event, timeout);
-	else
+	if(event) {
+	    if(WaitForSingleObject(event, timeout) == WAIT_OBJECT_0)
+		return 1;
+	} else
 	    Sleep(timeout);
 	return 0;
     }
+    setme = malloc(2 * sizeof(HANDLE));
+    setme[0] = CreateEvent(NULL, TRUE, FALSE, NULL);
+    setme[1] = event;
     items = malloc(nfds * sizeof(struct w32polldata));
     for(i=0; i<nfds; i++) {
 	items[i].event = CreateEvent(NULL, TRUE, FALSE, NULL);
@@ -404,7 +416,11 @@ int poll_with_event(struct pollfd *fds, int nfds, int timeout, HANDLE event) {
 	    /* handle errors here */
 	}
     }
-    WaitForMultipleObjects(2 - (event == NULL) , setme, FALSE, timeout);
+    if((ret = WaitForMultipleObjects(2 - (event == NULL), setme, FALSE, timeout)) == WAIT_OBJECT_0 + 1) {
+	ret = 1;
+    } else {
+	ret = 0;
+    }
     for(i=0; i<nfds; i++) {
 	UnregisterWait(items[i].waiter);
 	WSAEventSelect(fds[i].fd, items[i].event, 0);
diff --git a/win32/compat/net.h b/win32/compat/net.h
index e69f0bf..2591abb 100644
--- a/win32/compat/net.h
+++ b/win32/compat/net.h
@@ -40,7 +40,7 @@ const char *w32_inet_ntop(int af, const void *src, char *dst, socklen_t size);
 struct hostent *w32_gethostbyname(const char *name);
 int w32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
 int poll_with_event(struct pollfd *fds, int nfds, int timeout, HANDLE event);
-int w32_accept(int sockfd, const struct sockaddr *addr, socklen_t *addrlen);
+int w32_accept(SOCKET sockfd, const struct sockaddr *addr, socklen_t *addrlen);
 int w32_listen(int sockfd, int backlog);
 int w32_shutdown(int sockfd, int how);
 

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list