public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: proc fd: return EACCES for HANDLE-less fds
@ 2019-01-13 22:16 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2019-01-13 22:16 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=8ae26f96ae710f8562162fd5d4e9a5d7434beb7b

commit 8ae26f96ae710f8562162fd5d4e9a5d7434beb7b
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Sun Jan 13 23:09:48 2019 +0100

    Cygwin: proc fd: return EACCES for HANDLE-less fds
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/fhandler_process_fd.cc | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/winsup/cygwin/fhandler_process_fd.cc b/winsup/cygwin/fhandler_process_fd.cc
index a3691d9..a33fd75 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 ())


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-01-13 22:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-13 22:16 [newlib-cygwin] Cygwin: proc fd: return EACCES for HANDLE-less fds Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).