This is the mail archive of the
mailing list for the GDB project.
Re: MinGW status for readline
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.)
``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 email@example.com http://cnswww.cns.cwru.edu/~chet/