Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2021-09-14 06:49:35 +0300
committerCorinna Vinschen <corinna@vinschen.de>2021-09-14 11:22:15 +0300
commit0d12015670a00b7ecb2db4f66368e863b68de13d (patch)
treea57ac37f29d6fd2a4dacef7edbd0164e861700b8
parent3e80b12fde6126d85ae2ee58ba57e499c57b6c92 (diff)
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.
-rw-r--r--winsup/cygwin/fhandler.h1
-rw-r--r--winsup/cygwin/fhandler_fifo.cc2
-rw-r--r--winsup/cygwin/fhandler_pipe.cc10
3 files changed, 13 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 13fba9a14..46381c397 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -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 *);
diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc
index aa89fa7ae..37498f547 100644
--- a/winsup/cygwin/fhandler_fifo.cc
+++ b/winsup/cygwin/fhandler_fifo.cc
@@ -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);
}
diff --git a/winsup/cygwin/fhandler_pipe.cc b/winsup/cygwin/fhandler_pipe.cc
index 70cfa3784..da473a1dc 100644
--- a/winsup/cygwin/fhandler_pipe.cc
+++ b/winsup/cygwin/fhandler_pipe.cc
@@ -516,6 +516,16 @@ fhandler_pipe_fifo::raw_write (const void *ptr, size_t len)
}
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)
{
if (read_mtx)