fixed introduced winpr bug in namedpipes
authorMartin Haimberger <martin.haimberger@thincast.com>
Mon, 26 May 2014 10:04:22 +0000 (03:04 -0700)
committerMartin Haimberger <martin.haimberger@thincast.com>
Mon, 26 May 2014 10:04:22 +0000 (03:04 -0700)
Bug was introduced by 5e09e37d42bd8896a687df830a95f5cb56e4d47c

winpr/libwinpr/pipe/pipe.h
winpr/libwinpr/synch/event.c

index 99ed438..a6c5d6d 100644 (file)
@@ -43,10 +43,6 @@ struct winpr_named_pipe
 {
        WINPR_HANDLE_DEF();
 
-       WINPR_NAMED_PIPE* pBaseNamedPipe;
-
-       DWORD dwRefCount;
-
        int clientfd;
        int serverfd;
 
@@ -65,6 +61,10 @@ struct winpr_named_pipe
        LPOVERLAPPED lpOverlapped;
 
        fnRemoveBaseNamedPipeFromList pfnRemoveBaseNamedPipeFromList;
+
+       WINPR_NAMED_PIPE* pBaseNamedPipe;
+       DWORD dwRefCount;
+
 };
 
 #endif
index 3a911b2..0bae21f 100644 (file)
@@ -271,8 +271,11 @@ int GetEventFileDescriptor(HANDLE hEvent)
        if (Type == HANDLE_TYPE_NAMED_PIPE)
        {
                WINPR_NAMED_PIPE *named = (WINPR_NAMED_PIPE *)hEvent;
-               if (named->ServerMode)
+               if (named->ServerMode) {
                        return named->serverfd;
+               } else {
+                       return named->clientfd;
+               }
        }
 
        return event->pipe_fd[0];