public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix BZ #219
@ 2004-06-14 13:57 Jakub Jelinek
  2004-06-15 20:09 ` Roland McGrath
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2004-06-14 13:57 UTC (permalink / raw)
  To: Ulrich Drepper, Roland McGrath; +Cc: Glibc hackers, kimdon

Hi!

If __libc_dlopen of some NSS module fails, lib_handle is set to (void *) -1l,
which certainly is not something we should pass to __libc_dlclose.
Similarly, __libc_dlopen doesn't like NULL to be passed to it either,
which can happen e.g. with --enable-static-nss, not sure if in other
cases too.

2004-06-14  Jakub Jelinek  <jakub@redhat.com>

	[BZ #219]
	* nss/nsswitch.c (free_mem) : Don't try to close a library handle
	if the handle is invalid.  Patch by David Kimdon <kimdon@esrf.fr>.

--- libc/nss/nsswitch.c.jj	2003-09-14 20:13:41.000000000 +0200
+++ libc/nss/nsswitch.c	2004-06-14 15:31:33.499653270 +0200
@@ -1,4 +1,5 @@
-/* Copyright (C) 1996-1999,2001,2002,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -749,7 +750,8 @@ libc_freeres_fn (free_mem)
     {
       service_library *oldl = library;
 
-      __libc_dlclose (library->lib_handle);
+      if (library->lib_handle && library->lib_handle != (void *) -1l)
+	__libc_dlclose (library->lib_handle);
 
       library = library->next;
       free (oldl);

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix BZ #219
  2004-06-14 13:57 [PATCH] Fix BZ #219 Jakub Jelinek
@ 2004-06-15 20:09 ` Roland McGrath
  0 siblings, 0 replies; 2+ messages in thread
From: Roland McGrath @ 2004-06-15 20:09 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Ulrich Drepper, Glibc hackers, kimdon

> 2004-06-14  Jakub Jelinek  <jakub@redhat.com>
> 
> 	[BZ #219]
> 	* nss/nsswitch.c (free_mem) : Don't try to close a library handle
> 	if the handle is invalid.  Patch by David Kimdon <kimdon@esrf.fr>.

Applied.


Thanks,
Roland

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-06-15 20:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-14 13:57 [PATCH] Fix BZ #219 Jakub Jelinek
2004-06-15 20:09 ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).