From a0626ebe27cd82210cf73434e518b258b59dcdb7 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 24 Oct 2001 04:16:45 +0000 Subject: Ensure that all fhandler_*::read definitions are __stdcall throughout. * fhandler.cc (fhandler_base::set_inheritance): Be more defensive in debugging code. * fhandler.h: Adjust regparms throughout to reflect passing 'this' parameter. * fhandler_console.cc (fhandler_console::read): Remove unneeded test. Only honor "key down" events. * miscfuncs.cc (strcasestr): Reorganize for efficient code use. (check_null_empty_str_errno): Ditto. (__check_null_invalid_struct_errno): Ditto. (__check_invalid_read_ptr_errno): Ditto. * syscalls.cc (_read): Return 0 when length == 0, as per Single UNIX Specification. --- winsup/cygwin/fhandler.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'winsup/cygwin/fhandler.cc') diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index cc205c087..1385223f0 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -1611,7 +1611,9 @@ fhandler_dev_null::dump (void) void fhandler_base::set_inheritance (HANDLE &h, int not_inheriting) { +#ifdef DEBUGGING HANDLE oh = h; +#endif /* Note that we could use SetHandleInformation here but it is not available on all platforms. Test cases seem to indicate that using DuplicateHandle in this fashion does not actually close the original handle, which is @@ -1621,7 +1623,8 @@ fhandler_base::set_inheritance (HANDLE &h, int not_inheriting) DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)) debug_printf ("DuplicateHandle failed, %E"); #ifdef DEBUGGING - setclexec_pid (oh, h, not_inheriting); + if (h) + setclexec_pid (oh, h, not_inheriting); #endif } -- cgit v1.2.3