mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-21 00:07:36 +08:00
The read handles of pipes created by CreateNamedPipe don't have FILE_WRITE_ATTRIBUTES access unless the pipe is created with PIPE_ACCESS_DUPLEX. This causes set_pipe_non_blocking to fail on such handles. To fix this, add a helper function nt_create, which uses NtCreateNamedPipeFile instead of CreateNamedPipe and gives us more flexibility in setting access rights. Use this helper function in fhandler_pipe::create (fhandler_pipe *[2], unsigned, int), which is the version of fhandler_pipe::create used by the pipe and pipe2 system calls. For convenience, also add a static member function fhandler_pipe::npfs_handle similar to those used by fhandler_fifo and fhandler_socket_unix.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cygwin documentation is available on the net at https://cygwin.com You might especially be interested in https://cygwin.com/faq/faq.html#faq.programming.building-cygwin