From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22776 invoked by alias); 11 Apr 2006 14:15:16 -0000 Received: (qmail 22768 invoked by uid 22791); 11 Apr 2006 14:15:16 -0000 X-Spam-Check-By: sourceware.org Received: from mpv4.TIS.CWRU.Edu (HELO mpv4.tis.cwru.edu) (129.22.105.34) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 11 Apr 2006 14:15:11 +0000 Received: from [129.22.8.211] (caleb.INS.CWRU.Edu [129.22.8.211]) by mpv4.tis.cwru.edu (MOS 3.7.5-GA) with ESMTP id ATH65642 (AUTH cpr); Tue, 11 Apr 2006 10:15:07 -0400 (EDT) Message-ID: <443BB9EB.2040701@case.edu> Date: Tue, 11 Apr 2006 14:40:00 -0000 From: Chet Ramey Reply-To: chet.ramey@case.edu User-Agent: Thunderbird 1.5 (Macintosh/20051201) MIME-Version: 1.0 To: bug-readline@gnu.org, gdb@sourceware.org CC: chet@case.edu Subject: Re: MinGW status for readline References: <20060407200149.GA28248@nevyn.them.org> <443BB2CA.20200@case.edu> <20060411135550.GA22588@nevyn.them.org> In-Reply-To: <20060411135550.GA22588@nevyn.them.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-04/txt/msg00134.txt.bz2 Daniel Jacobowitz wrote: > On Tue, Apr 11, 2006 at 09:44:42AM -0400, Chet Ramey wrote: >> Daniel Jacobowitz wrote: >> >>> 1. Readline 5.1 currently fails to build for MinGW, in tilde.c. The >>> problem is: >>> >>> dirname = glue_prefix_and_suffix (user_entry->pw_dir, filename, user_len); >>> >>> I've just moved the else branch inside the #if defined (HAVE_GETPWENT), >>> from just below. With that change, readline builds. Here's the patch: >> Thanks, though that patch introduces a memory leak. > > How? Oh, if HAVE_GETPWNAME but not HAVE_GETPWENT? I'm not sure why > you've got a call to endpwent there at all; I thought that only closed > getpwent, not getpwnam, and that path doesn't call getpwent. No, you never free username. isolate_tilde_prefix allocates memory whether you have the getpwent family available or not. (I call endpwent() because its sole usual purpose is to close any open file descriptors on the password database, whatever it is. getpwent and getpwnam usually keep the database open.) Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ( ``Discere est Dolere'' -- chet ) Live Strong. No day but today. Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/