From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29125 invoked by alias); 14 Jun 2004 13:57:03 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 29087 invoked from network); 14 Jun 2004 13:56:59 -0000 Received: from unknown (HELO sunsite.ms.mff.cuni.cz) (195.113.15.26) by sourceware.org with SMTP; 14 Jun 2004 13:56:59 -0000 Received: from sunsite.ms.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8) with ESMTP id i5EBgi3j023271; Mon, 14 Jun 2004 13:42:44 +0200 Received: (from jakub@localhost) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8/Submit) id i5EBgihZ023253; Mon, 14 Jun 2004 13:42:44 +0200 Date: Mon, 14 Jun 2004 13:57:00 -0000 From: Jakub Jelinek To: Ulrich Drepper , Roland McGrath Cc: Glibc hackers , kimdon@esrf.fr Subject: [PATCH] Fix BZ #219 Message-ID: <20040614114243.GU5191@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-SW-Source: 2004-06/txt/msg00025.txt.bz2 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 [BZ #219] * nss/nsswitch.c (free_mem) : Don't try to close a library handle if the handle is invalid. Patch by David Kimdon . --- 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 , 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