Cygwin: open: handle O_CLOEXEC when opening file from handle

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2019-01-08 18:50:11 +01:00
parent 9ba65ab8b5
commit 0c545f3264
1 changed files with 5 additions and 1 deletions

View File

@ -555,7 +555,11 @@ fhandler_base::open (int flags, mode_t mode)
/* Allow to reopen from handle. This is utilized by
open ("/proc/PID/fd/DESCRIPTOR", ...); */
if (get_handle ())
pc.init_reopen_attr (attr, get_handle ());
{
pc.init_reopen_attr (attr, get_handle ());
if (!(flags & O_CLOEXEC))
attr.Attributes |= OBJ_INHERIT;
}
else
pc.get_object_attr (attr, *sec_none_cloexec (flags));