summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2019-01-13 23:09:48 +0100
committerCorinna Vinschen <corinna@vinschen.de>2019-01-13 23:09:48 +0100
commit8ae26f96ae710f8562162fd5d4e9a5d7434beb7b (patch)
tree53de70fb1006cf4248f35227449a277bb3700705
parent7f601990327861fdcacadf5985c2ef5161cb2554 (diff)
downloadcygnal-8ae26f96ae710f8562162fd5d4e9a5d7434beb7b.tar.gz
cygnal-8ae26f96ae710f8562162fd5d4e9a5d7434beb7b.tar.bz2
cygnal-8ae26f96ae710f8562162fd5d4e9a5d7434beb7b.zip
Cygwin: proc fd: return EACCES for HANDLE-less fds
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r--winsup/cygwin/fhandler_process_fd.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler_process_fd.cc b/winsup/cygwin/fhandler_process_fd.cc
index a3691d9c8..a33fd7539 100644
--- a/winsup/cygwin/fhandler_process_fd.cc
+++ b/winsup/cygwin/fhandler_process_fd.cc
@@ -69,6 +69,13 @@ fhandler_process_fd::fetch_fh (HANDLE &out_hdl, uint32_t flags)
}
hdl = pc.deserialize (buf);
}
+ if (hdl == NULL)
+ {
+ if (proc != GetCurrentProcess ())
+ CloseHandle (proc);
+ set_errno (EACCES);
+ return NULL;
+ }
BOOL ret = DuplicateHandle (proc, hdl, GetCurrentProcess (), &hdl,
0, FALSE, DUPLICATE_SAME_ACCESS);
if (proc != GetCurrentProcess ())