aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/pipe.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2004-09-09 08:58:44 +0000
committerCorinna Vinschen <corinna@vinschen.de>2004-09-09 08:58:44 +0000
commit6423296840ac7d7dc80bfc8a48b5b02ee23ff277 (patch)
treea8292cd3768ae2ccf4f6bfe6a730ae9c8abfd5e7 /winsup/cygwin/pipe.cc
parentbbb5869af96939fd7696df5e7d7232ad2d249179 (diff)
downloadnewlib-6423296840ac7d7dc80bfc8a48b5b02ee23ff277.zip
newlib-6423296840ac7d7dc80bfc8a48b5b02ee23ff277.tar.gz
newlib-6423296840ac7d7dc80bfc8a48b5b02ee23ff277.tar.bz2
* pipe.cc (create_selectable_pipe): Work around bug in Windows 95
where CreateNamedPipe returns NULL.
Diffstat (limited to 'winsup/cygwin/pipe.cc')
-rw-r--r--winsup/cygwin/pipe.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc
index 2a0095f..aff3dd1 100644
--- a/winsup/cygwin/pipe.cc
+++ b/winsup/cygwin/pipe.cc
@@ -259,6 +259,7 @@ create_selectable_pipe (PHANDLE read_pipe_ptr,
the pipe was not created earlier by some other process, even if
the pid has been reused. We avoid FILE_FLAG_FIRST_PIPE_INSTANCE
because that is only available for Win2k SP2 and WinXP. */
+ SetLastError (0);
read_pipe = CreateNamedPipe (pipename,
PIPE_ACCESS_INBOUND,
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE,
@@ -268,13 +269,14 @@ create_selectable_pipe (PHANDLE read_pipe_ptr,
NMPWAIT_USE_DEFAULT_WAIT,
sa_ptr);
- if (read_pipe != INVALID_HANDLE_VALUE)
+ DWORD err = GetLastError ();
+ /* Win 95 seems to return NULL instead of INVALID_HANDLE_VALUE */
+ if ((read_pipe || !err) && read_pipe != INVALID_HANDLE_VALUE)
{
debug_printf ("pipe read handle %p", read_pipe);
break;
}
- DWORD err = GetLastError ();
switch (err)
{
case ERROR_PIPE_BUSY: