summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/pipe.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-04-30 15:38:45 +0000
committerChristopher Faylor <me@cgf.cx>2012-04-30 15:38:45 +0000
commit28c8ae66d5ab61600f7d32d8aabbf9dfbfb3d9f8 (patch)
tree34b1ba591ba85339f9a9e624ba253d4d12041bee /winsup/cygwin/pipe.cc
parentc9306c71eddb0cf1f6e3b02cb1d4550331015de1 (diff)
downloadcygnal-28c8ae66d5ab61600f7d32d8aabbf9dfbfb3d9f8.tar.gz
cygnal-28c8ae66d5ab61600f7d32d8aabbf9dfbfb3d9f8.tar.bz2
cygnal-28c8ae66d5ab61600f7d32d8aabbf9dfbfb3d9f8.zip
* fhandler.h (PIPE_ADD_PID): Define new flag.
* pipe.cc (fhandler_pipe::create): Don't indiscriminately add process id to every pipe since some pipe names (fifo, tty) don't need it. * sigproc.cc (sigproc_init): Pass PIPE_ADD_PID to fhandler_pipe::create to ensure that pid is always part of sigwait pipe name.
Diffstat (limited to 'winsup/cygwin/pipe.cc')
-rw-r--r--winsup/cygwin/pipe.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc
index e8d15915f..e5909c4d4 100644
--- a/winsup/cygwin/pipe.cc
+++ b/winsup/cygwin/pipe.cc
@@ -211,9 +211,8 @@ fhandler_pipe::create (LPSECURITY_ATTRIBUTES sa_ptr, PHANDLE r, PHANDLE w,
psize = DEFAULT_PIPEBUFSIZE;
char pipename[MAX_PATH];
- const size_t len = __small_sprintf (pipename, PIPE_INTRO "%S-%u-",
- &cygheap->installation_key,
- GetCurrentProcessId ());
+ size_t len = __small_sprintf (pipename, PIPE_INTRO "%S-",
+ &cygheap->installation_key);
DWORD pipe_mode = PIPE_READMODE_BYTE;
if (!name)
pipe_mode |= pipe_byte ? PIPE_TYPE_BYTE : PIPE_TYPE_MESSAGE;
@@ -223,6 +222,12 @@ fhandler_pipe::create (LPSECURITY_ATTRIBUTES sa_ptr, PHANDLE r, PHANDLE w,
pipe_mode |= PIPE_TYPE_MESSAGE;
}
+ if (!name || (open_mode &= PIPE_ADD_PID))
+ {
+ len += __small_sprintf (pipename + len, "%u-", GetCurrentProcessId ());
+ open_mode &= ~PIPE_ADD_PID;
+ }
+
open_mode |= PIPE_ACCESS_INBOUND;
/* Retry CreateNamedPipe as long as the pipe name is in use.