diff options
author | Robert Collins <rbtcollins@hotmail.com> | 2002-01-17 09:37:29 +0300 |
---|---|---|
committer | Robert Collins <rbtcollins@hotmail.com> | 2002-01-17 09:37:29 +0300 |
commit | c0be6f1f26eed3fe239b9f79e1a7db9f918e2fd8 (patch) | |
tree | e96a9fbbd9c3fe5f4b727bdf23758c34f328c161 /winsup | |
parent | 1f51abac41262a13eb958bb52fe9dba788e53aa6 (diff) |
2002-01-17 Robert Collins <rbtcollins@hotmail.com>
* cygserver.cc (check_and_dup_handle): Consolidate the two variants for
simplicity.
Add Some basic debug output.
(client_request_attach_tty::serve): Use the new debug_printf for clarity.
Mark the duplicated handles as inheritable - fixup_after_fork() doesn't reopen
tty's.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 9 | ||||
-rwxr-xr-x | winsup/cygwin/cygserver.cc | 21 |
2 files changed, 14 insertions, 16 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index e3533bd30..a86c64af2 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,12 @@ +2002-01-17 Robert Collins <rbtcollins@hotmail.com> + + * cygserver.cc (check_and_dup_handle): Consolidate the two variants for + simplicity. + Add Some basic debug output. + (client_request_attach_tty::serve): Use the new debug_printf for clarity. + Mark the duplicated handles as inheritable - fixup_after_fork() doesn't reopen + tty's. + 2002-01-16 Robert Collins <rbtcollins@hotmail.com> * cygserver.cc (transport): Correct scope. diff --git a/winsup/cygwin/cygserver.cc b/winsup/cygwin/cygserver.cc index 343b0960d..57f92c2ac 100755 --- a/winsup/cygwin/cygserver.cc +++ b/winsup/cygwin/cygserver.cc @@ -88,7 +88,7 @@ check_and_dup_handle (HANDLE from_process, HANDLE to_process, HANDLE from_process_token, DWORD access, HANDLE from_handle, - HANDLE* to_handle_ptr, BOOL bInheritHandle) + HANDLE* to_handle_ptr, BOOL bInheritHandle = FALSE) { HANDLE local_handle = NULL; int ret_val = EACCES; @@ -143,6 +143,7 @@ check_and_dup_handle (HANDLE from_process, HANDLE to_process, printf ( "error getting handle to client (%lu)\n", GetLastError ()); goto out; } + debug_printf ("Duplicated %p to %p\n", from_handle, *to_handle_ptr); ret_val = 0; @@ -153,16 +154,6 @@ out: return (ret_val); } -int -check_and_dup_handle (HANDLE from_process, HANDLE to_process, - HANDLE from_process_token, - DWORD access, - HANDLE from_handle, - HANDLE* to_handle_ptr) -{ - return check_and_dup_handle(from_process,to_process,from_process_token,access,from_handle,to_handle_ptr,FALSE); -} - void client_request::serve (transport_layer_base *conn, class process_cache *cache) { @@ -186,11 +177,9 @@ client_request_attach_tty::serve(transport_layer_base *conn, class process_cache return; } -#if DEBUG - printf ("pid %ld:(%p,%p) -> pid %ld\n", req.master_pid, + debug_printf ("pid %ld:(%p,%p) -> pid %ld\n", req.master_pid, req.from_master, req.to_master, req.pid); -#endif debug_printf ("opening process %ld\n", req.master_pid); from_process_handle = OpenProcess (PROCESS_DUP_HANDLE, FALSE, req.master_pid); @@ -226,7 +215,7 @@ client_request_attach_tty::serve(transport_layer_base *conn, class process_cache token_handle, GENERIC_READ, req.from_master, - &req.from_master) != 0) + &req.from_master, TRUE) != 0) { printf ("error duplicating from_master handle (%lu)\n", GetLastError ()); header.error_code = EACCES; @@ -239,7 +228,7 @@ client_request_attach_tty::serve(transport_layer_base *conn, class process_cache token_handle, GENERIC_WRITE, req.to_master, - &req.to_master) != 0) + &req.to_master, TRUE) != 0) { printf ("error duplicating to_master handle (%lu)\n", GetLastError ()); header.error_code = EACCES; |