Cygwin: fhandler_base::dup Reflect O_CLOEXEC to inheritance flag.
- Currently fhandler_base::dup duplicates handles with bInheritHandle TRUE unconditionally. This patch reflects O_CLOEXEC flag to that parameter.
This commit is contained in:
parent
8985f1c7c4
commit
3e80b12fde
|
@ -1308,7 +1308,7 @@ fhandler_base::init (HANDLE f, DWORD a, mode_t bin)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fhandler_base::dup (fhandler_base *child, int)
|
fhandler_base::dup (fhandler_base *child, int flags)
|
||||||
{
|
{
|
||||||
debug_printf ("in fhandler_base dup");
|
debug_printf ("in fhandler_base dup");
|
||||||
|
|
||||||
|
@ -1317,7 +1317,7 @@ fhandler_base::dup (fhandler_base *child, int)
|
||||||
{
|
{
|
||||||
if (!DuplicateHandle (GetCurrentProcess (), get_handle (),
|
if (!DuplicateHandle (GetCurrentProcess (), get_handle (),
|
||||||
GetCurrentProcess (), &nh,
|
GetCurrentProcess (), &nh,
|
||||||
0, TRUE, DUPLICATE_SAME_ACCESS))
|
0, !(flags & O_CLOEXEC), DUPLICATE_SAME_ACCESS))
|
||||||
{
|
{
|
||||||
debug_printf ("dup(%s) failed, handle %p, %E",
|
debug_printf ("dup(%s) failed, handle %p, %E",
|
||||||
get_name (), get_handle ());
|
get_name (), get_handle ());
|
||||||
|
|
Loading…
Reference in New Issue