* 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.
This commit is contained in:
Christopher Faylor 2007-07-10 01:21:03 +00:00
parent 99b0856099
commit be1cabba23
5 changed files with 22 additions and 11 deletions

View File

@ -1,3 +1,15 @@
2007-07-09 Christopher Faylor <me+cygwin@cgf.cx>
* 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 <me+cygwin@cgf.cx> 2007-07-09 Christopher Faylor <me+cygwin@cgf.cx>
* strsig.cc (__signals): New macro. * strsig.cc (__signals): New macro.

View File

@ -1,6 +1,7 @@
/* debug.cc /* 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 This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for 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 1 /* Uncomment to see CloseHandle failures */
if (!ret) 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 #endif
return ret; return ret;
} }

View File

@ -145,12 +145,10 @@ int
dlclose (void *handle) dlclose (void *handle)
{ {
int ret = -1; int ret = -1;
void *temphandle = (void *) GetModuleHandle (NULL); if (handle == GetModuleHandle (NULL) || FreeLibrary ((HMODULE) handle))
if (temphandle == handle || FreeLibrary ((HMODULE) handle))
ret = 0; ret = 0;
if (ret) if (ret)
set_dl_error ("dlclose"); set_dl_error ("dlclose");
CloseHandle ((HMODULE) temphandle);
return ret; return ret;
} }

View File

@ -546,8 +546,8 @@ public:
int __stdcall fadvise (_off64_t, _off64_t, int) __attribute__ ((regparm (3))); int __stdcall fadvise (_off64_t, _off64_t, int) __attribute__ ((regparm (3)));
int __stdcall ftruncate (_off64_t, bool) __attribute__ ((regparm (3))); int __stdcall ftruncate (_off64_t, bool) __attribute__ ((regparm (3)));
int ready_for_read (int fd, DWORD howlong); int ready_for_read (int fd, DWORD howlong);
static int create (fhandler_pipe *[2], unsigned, int, bool = false); static int create (fhandler_pipe *[2], unsigned, int);
static int create_selectable (LPSECURITY_ATTRIBUTES, HANDLE&, HANDLE&, DWORD, bool); static int create_selectable (LPSECURITY_ATTRIBUTES, HANDLE&, HANDLE&, DWORD);
}; };
enum fifo_state enum fifo_state

View File

@ -181,13 +181,13 @@ fhandler_pipe::dup (fhandler_base *child)
unlike CreatePipe, which returns a bool for success or failure. */ unlike CreatePipe, which returns a bool for success or failure. */
int int
fhandler_pipe::create_selectable (LPSECURITY_ATTRIBUTES sa_ptr, HANDLE& r, fhandler_pipe::create_selectable (LPSECURITY_ATTRIBUTES sa_ptr, HANDLE& r,
HANDLE& w, DWORD psize, bool fifo) HANDLE& w, DWORD psize)
{ {
/* Default to error. */ /* Default to error. */
r = w = INVALID_HANDLE_VALUE; r = w = INVALID_HANDLE_VALUE;
/* Ensure that there is enough pipe buffer space for atomic writes. */ /* Ensure that there is enough pipe buffer space for atomic writes. */
if (!fifo && psize < PIPE_BUF) if (psize < PIPE_BUF)
psize = PIPE_BUF; psize = PIPE_BUF;
char pipename[CYG_MAX_PATH]; char pipename[CYG_MAX_PATH];
@ -269,13 +269,13 @@ fhandler_pipe::create_selectable (LPSECURITY_ATTRIBUTES sa_ptr, HANDLE& r,
} }
int 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; HANDLE r, w;
SECURITY_ATTRIBUTES *sa = (mode & O_NOINHERIT) ? &sec_none_nih : &sec_none; SECURITY_ATTRIBUTES *sa = (mode & O_NOINHERIT) ? &sec_none_nih : &sec_none;
int res = -1; int res = -1;
int ret = create_selectable (sa, r, w, psize, fifo); int ret = create_selectable (sa, r, w, psize);
if (ret) if (ret)
__seterrno_from_win_error (ret); __seterrno_from_win_error (ret);
else else