aboutsummaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2021-09-14 12:49:35 +0900
committerCorinna Vinschen <corinna@vinschen.de>2021-09-14 10:22:15 +0200
commit0d12015670a00b7ecb2db4f66368e863b68de13d (patch)
treea57ac37f29d6fd2a4dacef7edbd0164e861700b8 /winsup
parent3e80b12fde6126d85ae2ee58ba57e499c57b6c92 (diff)
downloadnewlib-0d12015670a00b7ecb2db4f66368e863b68de13d.zip
newlib-0d12015670a00b7ecb2db4f66368e863b68de13d.tar.gz
newlib-0d12015670a00b7ecb2db4f66368e863b68de13d.tar.bz2
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.
Diffstat (limited to 'winsup')
-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 13fba9a..46381c3 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 aa89fa7..37498f5 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 70cfa37..da473a1 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)