Cygwin: pipe, fifo: Call set_no_inheritance() for adjunct handles.

- Currntly, set_no_inheritance() is not called for the adjunct handles
  such as select_sem. This patch fixes the issue.
This commit is contained in:
Takashi Yano 2021-09-14 12:49:35 +09:00 committed by Corinna Vinschen
parent 3e80b12fde
commit 0d12015670
3 changed files with 13 additions and 0 deletions

View File

@ -1208,6 +1208,7 @@ public:
void open_setup (int flags);
void fixup_after_fork (HANDLE);
int dup (fhandler_base *child, int);
void set_close_on_exec (bool val);
int close ();
void __reg3 raw_read (void *ptr, size_t& len);
int ioctl (unsigned int cmd, void *);

View File

@ -1817,4 +1817,6 @@ fhandler_fifo::set_close_on_exec (bool val)
set_no_inheritance (fc_handler[i].h, val);
fifo_client_unlock ();
}
if (select_sem)
set_no_inheritance (select_sem, val);
}

View File

@ -515,6 +515,16 @@ fhandler_pipe_fifo::raw_write (const void *ptr, size_t len)
return nbytes ?: -1;
}
void
fhandler_pipe::set_close_on_exec (bool val)
{
fhandler_base::set_close_on_exec (val);
if (read_mtx)
set_no_inheritance (read_mtx, val);
if (select_sem)
set_no_inheritance (select_sem, val);
}
void
fhandler_pipe::fixup_after_fork (HANDLE parent)
{