diff options
author | Christopher Faylor <me@cgf.cx> | 2001-08-22 17:50:22 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-08-22 17:50:22 +0000 |
commit | 0a047e8f321216f24140ee18135bbe9ea4461f0a (patch) | |
tree | e8bc85a9d7a597f57dccb8ec64e0ff8a479c2249 /winsup/cygwin/debug.cc | |
parent | 1fdc8df95d7723d278daf4c3ce2f856d8d1db276 (diff) | |
download | cygnal-0a047e8f321216f24140ee18135bbe9ea4461f0a.tar.gz cygnal-0a047e8f321216f24140ee18135bbe9ea4461f0a.tar.bz2 cygnal-0a047e8f321216f24140ee18135bbe9ea4461f0a.zip |
* smallprint.c (console_printf): New function.
* dcrt0.cc (dll_crt0_1): Use console_printf for debugging output.
* debug.cc (debug_mark_closed): New function.
(close_handle): Use debug_mark_closed.
* debug.h: Declare new functions.
* dtable.cc (dtable::build_fhandler): Remove unneeded extern.
* spawn.cc: Cosmetic changes.
* winsup.h: Define NO_COPY for C files, too. Declare a global.
Diffstat (limited to 'winsup/cygwin/debug.cc')
-rw-r--r-- | winsup/cygwin/debug.cc | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/winsup/cygwin/debug.cc b/winsup/cygwin/debug.cc index bd58e47b4..551a12d7d 100644 --- a/winsup/cygwin/debug.cc +++ b/winsup/cygwin/debug.cc @@ -275,15 +275,11 @@ out: unlock_debug (); } -/* Close a known handle. Complain if !force and closing a known handle or - if the name of the handle being closed does not match the registered name. */ -BOOL __stdcall -close_handle (const char *func, int ln, HANDLE h, const char *name, BOOL force) +bool __stdcall +debug_mark_closed (const char *func, int ln, HANDLE h, const char *name, BOOL force) { - BOOL ret; handle_list *hl; lock_debug (); - if ((hl = find_handle (h)) && !force) { hl = hl->next; @@ -301,7 +297,7 @@ close_handle (const char *func, int ln, HANDLE h, const char *name, BOOL force) hln->func, hln->ln, hln->name, hln->h); system_printf (" by %s:%d(%s<%p>)", func, ln, name, h); } - ret = CloseHandle (h); + if (hl) { handle_list *hnuke = hl->next; @@ -313,6 +309,23 @@ close_handle (const char *func, int ln, HANDLE h, const char *name, BOOL force) } unlock_debug (); + return TRUE; +} + +/* Close a known handle. Complain if !force and closing a known handle or + if the name of the handle being closed does not match the registered name. */ +BOOL __stdcall +close_handle (const char *func, int ln, HANDLE h, const char *name, BOOL force) +{ + BOOL ret; + lock_debug (); + + if (!debug_mark_closed (func, ln, h, name, force)) + return FALSE; + + ret = CloseHandle (h); + + unlock_debug (); #if 0 /* Uncomment to see CloseHandle failures */ if (!ret) small_printf ("CloseHandle(%s) failed %s:%d\n", name, func, ln); |