diff --git a/winsup/cygserver/ChangeLog b/winsup/cygserver/ChangeLog index 63a37c624..634c67cf8 100644 --- a/winsup/cygserver/ChangeLog +++ b/winsup/cygserver/ChangeLog @@ -1,3 +1,12 @@ +2012-11-26 Corinna Vinschen + + * transport_pipes.cc (pipe_instance_lock_once): Remove. + (pipe_instance_lock): Remove. + (pipe_instance): Remove. + (initialise_pipe_instance_lock): Remove. + (transport_layer_pipes::accept): Drop entire pipe_instance handling. + (transport_layer_pipes::close): Ditto. + 2012-11-23 Corinna Vinschen * cygserver.cc (main): Call listen right after creating the diff --git a/winsup/cygserver/transport_pipes.cc b/winsup/cygserver/transport_pipes.cc index ccd505d17..dda15d3d4 100644 --- a/winsup/cygserver/transport_pipes.cc +++ b/winsup/cygserver/transport_pipes.cc @@ -52,21 +52,6 @@ enum #ifndef __INSIDE_CYGWIN__ -static pthread_once_t pipe_instance_lock_once = PTHREAD_ONCE_INIT; -static CRITICAL_SECTION pipe_instance_lock; -static long pipe_instance = 0; - -static void -initialise_pipe_instance_lock () -{ - assert (pipe_instance == 0); - InitializeCriticalSection (&pipe_instance_lock); -} - -#endif /* !__INSIDE_CYGWIN__ */ - -#ifndef __INSIDE_CYGWIN__ - transport_layer_pipes::transport_layer_pipes (const HANDLE hPipe) : _hPipe (hPipe), _is_accepted_endpoint (true), @@ -143,26 +128,13 @@ transport_layer_pipes::accept (bool *const recoverable) assert (!_is_accepted_endpoint); assert (_is_listening_endpoint); - pthread_once (&pipe_instance_lock_once, &initialise_pipe_instance_lock); - - EnterCriticalSection (&pipe_instance_lock); - - // Read: http://www.securityinternals.com/research/papers/namedpipe.php - // See also the Microsoft security bulletins MS00-053 and MS01-031. - - debug ("Try to create named pipe instance %ld: %ls", - pipe_instance + 1, _pipe_name); + debug ("Try to create named pipe instance: %ls", _pipe_name); const HANDLE accept_pipe = CreateNamedPipeW (_pipe_name, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, 0, 0, 1000, &sec_all_nih); - if (accept_pipe != INVALID_HANDLE_VALUE) - InterlockedIncrement (&pipe_instance); - - LeaveCriticalSection (&pipe_instance_lock); - if (accept_pipe == INVALID_HANDLE_VALUE) { debug_printf ("error creating pipe (%lu).", GetLastError ()); @@ -199,11 +171,7 @@ transport_layer_pipes::close () { (void) FlushFileBuffers (_hPipe); // Blocks until client reads. (void) DisconnectNamedPipe (_hPipe); - EnterCriticalSection (&pipe_instance_lock); (void) CloseHandle (_hPipe); - assert (pipe_instance > 0); - InterlockedDecrement (&pipe_instance); - LeaveCriticalSection (&pipe_instance_lock); } else (void) CloseHandle (_hPipe);