* 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.
This commit is contained in:
Christopher Faylor 2012-05-12 19:17:17 +00:00
parent 991addc261
commit 348b56b5a3
5 changed files with 41 additions and 6 deletions

View File

@ -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.

View File

@ -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:

View File

@ -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;

View File

@ -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;
}
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.

View File

@ -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