Cygwin: proc fd: return EACCES for HANDLE-less fds
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
7f60199032
commit
8ae26f96ae
|
@ -69,6 +69,13 @@ fhandler_process_fd::fetch_fh (HANDLE &out_hdl, uint32_t flags)
|
||||||
}
|
}
|
||||||
hdl = pc.deserialize (buf);
|
hdl = pc.deserialize (buf);
|
||||||
}
|
}
|
||||||
|
if (hdl == NULL)
|
||||||
|
{
|
||||||
|
if (proc != GetCurrentProcess ())
|
||||||
|
CloseHandle (proc);
|
||||||
|
set_errno (EACCES);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
BOOL ret = DuplicateHandle (proc, hdl, GetCurrentProcess (), &hdl,
|
BOOL ret = DuplicateHandle (proc, hdl, GetCurrentProcess (), &hdl,
|
||||||
0, FALSE, DUPLICATE_SAME_ACCESS);
|
0, FALSE, DUPLICATE_SAME_ACCESS);
|
||||||
if (proc != GetCurrentProcess ())
|
if (proc != GetCurrentProcess ())
|
||||||
|
|
Loading…
Reference in New Issue