httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jchamp...@apache.org
Subject svn commit: r1758310 - /httpd/httpd/trunk/server/mpm/winnt/child.c
Date Mon, 29 Aug 2016 23:56:21 GMT
Author: jchampion
Date: Mon Aug 29 23:56:21 2016
New Revision: 1758310

URL: http://svn.apache.org/viewvc?rev=1758310&view=rev
Log:
mpm_winnt: clear OVERLAPPED structs before reuse

MSDN documentation states that

    Any unused members of [an OVERLAPPED] structure should always be
    initialized to zero before the structure is used in a function call.
    Otherwise, the function may fail and return ERROR_INVALID_PARAMETER.

Prior to this patch, the internal state left over from previous
overlapped I/O was passed into the next call. It's unclear what effect
this might have, if any. (I have not personally witnessed an
ERROR_INVALID_PARAMETER myself.)

Modified:
    httpd/httpd/trunk/server/mpm/winnt/child.c

Modified: httpd/httpd/trunk/server/mpm/winnt/child.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/winnt/child.c?rev=1758310&r1=1758309&r2=1758310&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/winnt/child.c (original)
+++ httpd/httpd/trunk/server/mpm/winnt/child.c Mon Aug 29 23:56:21 2016
@@ -136,10 +136,17 @@ static void mpm_recycle_completion_conte
      * state so -don't- close it.
      */
     if (context) {
+        HANDLE saved_event;
+
         apr_pool_clear(context->ptrans);
         context->ba = apr_bucket_alloc_create(context->ptrans);
         context->next = NULL;
+
+        saved_event = context->overlapped.hEvent;
+        memset(&context->overlapped, 0, sizeof(context->overlapped));
+        context->overlapped.hEvent = saved_event;
         ResetEvent(context->overlapped.hEvent);
+
         apr_thread_mutex_lock(qlock);
         if (qtail) {
             qtail->next = context;



Mime
View raw message