From be1cabba238ce5af7a11a852d9d528aa2f102c42 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Tue, 10 Jul 2007 01:21:03 +0000 Subject: [PATCH] * debug.cc (close_handle): Change debug output format slightly. * dlfcn.cc (dlclose): Don't close handle returned from GetModuleHandle(NULL). * fhandler.h (fhandler_pipe::create): Remove obsolete argument. (fhandler_pipe::create): Ditto. * fhandler.cc (fhandler_pipe::create): Ditto. (fhandler_pipe::create): Ditto. --- winsup/cygwin/ChangeLog | 12 ++++++++++++ winsup/cygwin/debug.cc | 5 +++-- winsup/cygwin/dlfcn.cc | 4 +--- winsup/cygwin/fhandler.h | 4 ++-- winsup/cygwin/pipe.cc | 8 ++++---- 5 files changed, 22 insertions(+), 11 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 0197dd377..83accc0c8 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,15 @@ +2007-07-09 Christopher Faylor + + * debug.cc (close_handle): Change debug output format slightly. + + * dlfcn.cc (dlclose): Don't close handle returned from + GetModuleHandle(NULL). + + * fhandler.h (fhandler_pipe::create): Remove obsolete argument. + (fhandler_pipe::create): Ditto. + * fhandler.cc (fhandler_pipe::create): Ditto. + (fhandler_pipe::create): Ditto. + 2007-07-09 Christopher Faylor * strsig.cc (__signals): New macro. diff --git a/winsup/cygwin/debug.cc b/winsup/cygwin/debug.cc index bb75b3162..4ef0872bc 100644 --- a/winsup/cygwin/debug.cc +++ b/winsup/cygwin/debug.cc @@ -1,6 +1,7 @@ /* debug.cc - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 + Red Hat, Inc. This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for @@ -240,7 +241,7 @@ close_handle (const char *func, int ln, HANDLE h, const char *name, bool force) #if 1 /* Uncomment to see CloseHandle failures */ if (!ret) - small_printf ("CloseHandle(%s) %p failed %s:%d, %E\n", name, h, func, ln); + small_printf ("CloseHandle(%s<%p>) failed %s:%d, %E\n", name, h, func, ln); #endif return ret; } diff --git a/winsup/cygwin/dlfcn.cc b/winsup/cygwin/dlfcn.cc index 5bea77419..3893045b3 100644 --- a/winsup/cygwin/dlfcn.cc +++ b/winsup/cygwin/dlfcn.cc @@ -145,12 +145,10 @@ int dlclose (void *handle) { int ret = -1; - void *temphandle = (void *) GetModuleHandle (NULL); - if (temphandle == handle || FreeLibrary ((HMODULE) handle)) + if (handle == GetModuleHandle (NULL) || FreeLibrary ((HMODULE) handle)) ret = 0; if (ret) set_dl_error ("dlclose"); - CloseHandle ((HMODULE) temphandle); return ret; } diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 996f361cc..07b26607e 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -546,8 +546,8 @@ public: int __stdcall fadvise (_off64_t, _off64_t, int) __attribute__ ((regparm (3))); int __stdcall ftruncate (_off64_t, bool) __attribute__ ((regparm (3))); int ready_for_read (int fd, DWORD howlong); - static int create (fhandler_pipe *[2], unsigned, int, bool = false); - static int create_selectable (LPSECURITY_ATTRIBUTES, HANDLE&, HANDLE&, DWORD, bool); + static int create (fhandler_pipe *[2], unsigned, int); + static int create_selectable (LPSECURITY_ATTRIBUTES, HANDLE&, HANDLE&, DWORD); }; enum fifo_state diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc index 637defb16..b9314aa4f 100644 --- a/winsup/cygwin/pipe.cc +++ b/winsup/cygwin/pipe.cc @@ -181,13 +181,13 @@ fhandler_pipe::dup (fhandler_base *child) unlike CreatePipe, which returns a bool for success or failure. */ int fhandler_pipe::create_selectable (LPSECURITY_ATTRIBUTES sa_ptr, HANDLE& r, - HANDLE& w, DWORD psize, bool fifo) + HANDLE& w, DWORD psize) { /* Default to error. */ r = w = INVALID_HANDLE_VALUE; /* Ensure that there is enough pipe buffer space for atomic writes. */ - if (!fifo && psize < PIPE_BUF) + if (psize < PIPE_BUF) psize = PIPE_BUF; char pipename[CYG_MAX_PATH]; @@ -269,13 +269,13 @@ fhandler_pipe::create_selectable (LPSECURITY_ATTRIBUTES sa_ptr, HANDLE& r, } int -fhandler_pipe::create (fhandler_pipe *fhs[2], unsigned psize, int mode, bool fifo) +fhandler_pipe::create (fhandler_pipe *fhs[2], unsigned psize, int mode) { HANDLE r, w; SECURITY_ATTRIBUTES *sa = (mode & O_NOINHERIT) ? &sec_none_nih : &sec_none; int res = -1; - int ret = create_selectable (sa, r, w, psize, fifo); + int ret = create_selectable (sa, r, w, psize); if (ret) __seterrno_from_win_error (ret); else