summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/pipe.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-05-12 19:17:17 +0000
committerChristopher Faylor <me@cgf.cx>2012-05-12 19:17:17 +0000
commit348b56b5a34e2037b98c30f229b16d1a7468a921 (patch)
tree3c633c49b16c011dfe1b8548e25493fce6fd5bdd /winsup/cygwin/pipe.cc
parent991addc2617fcfde49ffd3a05e1b26f3cfc7c918 (diff)
downloadcygnal-348b56b5a34e2037b98c30f229b16d1a7468a921.tar.gz
cygnal-348b56b5a34e2037b98c30f229b16d1a7468a921.tar.bz2
cygnal-348b56b5a34e2037b98c30f229b16d1a7468a921.zip
* DevNotes: Add entry cgf-000005.
* fhandler.h (PIPE_ADD_PID): Redefine to something we actually DON'T use. * pipe.cc (fhandler_pipe::create): Avoid clearing all open_mode bits when checking for PIPE_ADD_PID. Properly keep track of len so that passed in name is not overwritten.
Diffstat (limited to 'winsup/cygwin/pipe.cc')
-rw-r--r--winsup/cygwin/pipe.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc
index e5909c4d4..6a88d4f1c 100644
--- a/winsup/cygwin/pipe.cc
+++ b/winsup/cygwin/pipe.cc
@@ -217,17 +217,17 @@ fhandler_pipe::create (LPSECURITY_ATTRIBUTES sa_ptr, PHANDLE r, PHANDLE w,
if (!name)
pipe_mode |= pipe_byte ? PIPE_TYPE_BYTE : PIPE_TYPE_MESSAGE;
else
- {
- strcpy (pipename + len, name);
- pipe_mode |= PIPE_TYPE_MESSAGE;
- }
+ pipe_mode |= PIPE_TYPE_MESSAGE;
- if (!name || (open_mode &= PIPE_ADD_PID))
+ if (!name || (open_mode & PIPE_ADD_PID))
{
len += __small_sprintf (pipename + len, "%u-", GetCurrentProcessId ());
open_mode &= ~PIPE_ADD_PID;
}
+ if (name)
+ len += __small_sprintf (pipename + len, "%s", name);
+
open_mode |= PIPE_ACCESS_INBOUND;
/* Retry CreateNamedPipe as long as the pipe name is in use.