Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-05-19 13:49:15 +0400
committerCorinna Vinschen <corinna@vinschen.de>2014-05-19 13:49:15 +0400
commitca6183c3445019c385243f4c58b6d1b0bd7ce62f (patch)
tree5d59d6cf6c1264f87a1ddb49ada24d20671bb998 /winsup
parent8c14a5065dd10a81d71230dcffa77e54b44b81f7 (diff)
* bsd_helper.cc (ipcexit_creat_hookthread): Delete shs to make
Coverity happy (CID 59993). * transport_pipes.cc (transport_layer_pipes::listen): Make listen_pipe and connect_pipe statics to make Coverity happy (CID 60010/60011).
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygserver/ChangeLog7
-rw-r--r--winsup/cygserver/bsd_helper.cc1
-rw-r--r--winsup/cygserver/transport_pipes.cc14
3 files changed, 18 insertions, 4 deletions
diff --git a/winsup/cygserver/ChangeLog b/winsup/cygserver/ChangeLog
index 431629d56..bd37073f2 100644
--- a/winsup/cygserver/ChangeLog
+++ b/winsup/cygserver/ChangeLog
@@ -1,3 +1,10 @@
+2014-05-19 Corinna Vinschen <corinna@vinschen.de>
+
+ * bsd_helper.cc (ipcexit_creat_hookthread): Delete shs to make
+ Coverity happy (CID 59993).
+ * transport_pipes.cc (transport_layer_pipes::listen): Make listen_pipe
+ and connect_pipe statics to make Coverity happy (CID 60010/60011).
+
2014-04-16 Corinna Vinschen <corinna@vinschen.de>
* pwdgrp.cc (client_request_pwdgrp::pwd_serve): Add 1 to the message
diff --git a/winsup/cygserver/bsd_helper.cc b/winsup/cygserver/bsd_helper.cc
index 8aa99964f..9b64918f9 100644
--- a/winsup/cygserver/bsd_helper.cc
+++ b/winsup/cygserver/bsd_helper.cc
@@ -209,6 +209,7 @@ ipcexit_creat_hookthread (struct thread *td)
HANDLE thread = CreateThread (NULL, 0, ipcexit_hookthread, shs, 0, &tid);
if (!thread)
{
+ delete shs;
log (LOG_CRIT, "failed to create thread, error = %u", GetLastError ());
return cygwin_internal (CW_GET_ERRNO_FROM_WINERROR,
GetLastError (), ENOMEM);
diff --git a/winsup/cygserver/transport_pipes.cc b/winsup/cygserver/transport_pipes.cc
index 8f3760741..fd5ef0914 100644
--- a/winsup/cygserver/transport_pipes.cc
+++ b/winsup/cygserver/transport_pipes.cc
@@ -83,6 +83,9 @@ transport_layer_pipes::~transport_layer_pipes ()
#ifndef __INSIDE_CYGWIN__
+static HANDLE listen_pipe;
+static HANDLE connect_pipe;
+
int
transport_layer_pipes::listen ()
{
@@ -94,16 +97,19 @@ transport_layer_pipes::listen ()
debug ("Try to create named pipe: %ls", _pipe_name);
- HANDLE listen_pipe =
+ /* We have to create the first instance of the listening pipe here, and
+ we also have to create at least one instance of the client side to avoid
+ a race condition.
+ See https://cygwin.com/ml/cygwin/2012-11/threads.html#00144 */
+ listen_pipe =
CreateNamedPipeW (_pipe_name,
PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE,
PIPE_TYPE_BYTE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES,
0, 0, 1000, &sec_all_nih);
if (listen_pipe != INVALID_HANDLE_VALUE)
{
- HANDLE connect_pipe =
- CreateFileW (_pipe_name, GENERIC_READ | GENERIC_WRITE, 0, &sec_all_nih,
- OPEN_EXISTING, 0, NULL);
+ connect_pipe = CreateFileW (_pipe_name, GENERIC_READ | GENERIC_WRITE, 0,
+ &sec_all_nih, OPEN_EXISTING, 0, NULL);
if (connect_pipe == INVALID_HANDLE_VALUE)
{
CloseHandle (listen_pipe);