public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>, Roland McGrath <roland@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>, kimdon@esrf.fr
Subject: [PATCH] Fix BZ #219
Date: Mon, 14 Jun 2004 13:57:00 -0000	[thread overview]
Message-ID: <20040614114243.GU5191@sunsite.ms.mff.cuni.cz> (raw)

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

             reply	other threads:[~2004-06-14 13:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-14 13:57 Jakub Jelinek [this message]
2004-06-15 20:09 ` Roland McGrath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040614114243.GU5191@sunsite.ms.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@redhat.com \
    --cc=kimdon@esrf.fr \
    --cc=libc-hacker@sources.redhat.com \
    --cc=roland@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).