aboutsummaryrefslogtreecommitdiff
path: root/winsup
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
parent991addc2617fcfde49ffd3a05e1b26f3cfc7c918 (diff)
downloadnewlib-348b56b5a34e2037b98c30f229b16d1a7468a921.zip
newlib-348b56b5a34e2037b98c30f229b16d1a7468a921.tar.gz
newlib-348b56b5a34e2037b98c30f229b16d1a7468a921.tar.bz2
* 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')
-rw-r--r--winsup/cygwin/ChangeLog9
-rw-r--r--winsup/cygwin/DevNotes19
-rw-r--r--winsup/cygwin/fhandler.h2
-rw-r--r--winsup/cygwin/pipe.cc10
-rw-r--r--winsup/cygwin/release/1.7.167
5 files changed, 41 insertions, 6 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 0b5385a..36d5545 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,12 @@
+2012-05-12 Christopher Faylor <me.cygwin2012@cgf.cx>
+
+ * 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.
+
2012-05-10 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* cygwin.din (memrchr): Export.
diff --git a/winsup/cygwin/DevNotes b/winsup/cygwin/DevNotes
index 11a01df..5ad1ab8 100644
--- a/winsup/cygwin/DevNotes
+++ b/winsup/cygwin/DevNotes
@@ -1,3 +1,22 @@
+2012-05-12 cgf-000005
+
+<1.7.16>
+- Fix pipe creation problem which manifested as a problem creating a
+fifo. Fixes: http://cygwin.com/ml/cygwin/2012-05/msg00253.html
+</1.7.16>
+
+My change on 2012-04-28 introduced a problem with fifos. The passed
+in name was overwritten. This was because I wasn't properly keeping
+track of the length of the generated pipe name when there was a
+name passed in to fhandler_pipe::create.
+
+There was also another problem in fhandler_pipe::create. Since fifos
+use PIPE_ACCESS_DUPLEX and PIPE_ACCESS_DUPLEX is an or'ing of
+PIPE_ACCESS_INBOUND and PIPE_ACCESS_OUTBOUND, using PIPE_ACCESS_OUTBOUND
+as a "never-used" option for PIPE_ADD_PID in fhandler.h was wrong. So,
+fifo creation attempted to add the pid of a pipe to the name which is
+wrong for fifos.
+
2012-05-08 cgf-000004
The change for cgf-000003 introduced a new problem:
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 2a639cd..18e829a 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -38,7 +38,7 @@ details. */
/* Used for fhandler_pipe::create. Use an available flag which will
never be used in Cygwin for this function. */
-#define PIPE_ADD_PID PIPE_ACCESS_OUTBOUND
+#define PIPE_ADD_PID FILE_FLAG_FIRST_PIPE_INSTANCE
extern const char *windows_device_names[];
extern struct __cygwin_perfile *perfile_table;
diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc
index e5909c4..6a88d4f 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.
diff --git a/winsup/cygwin/release/1.7.16 b/winsup/cygwin/release/1.7.16
index 92d3996..fe4fc6c 100644
--- a/winsup/cygwin/release/1.7.16
+++ b/winsup/cygwin/release/1.7.16
@@ -2,3 +2,10 @@ What's new:
-----------
- New API: memrchr.
+
+Bug fixes:
+----------
+
+- Fix pipe creation problem which manifested as a problem creating a
+fifo. Fixes: http://cygwin.com/ml/cygwin/2012-05/msg00253.html
+