Simon Josefsson wrote: > This makes the gnulib 'getpass' module (not the 'getpass-gnu' module) > rather difficult to use: how do you know whether to de-allocate the > returned string or not? It depends on whether the system function or > the gnulib replacement was used.
Good point. > Another way of looking at this is that > there is a memory leak in the gnulib 'getpass' module. It's hard to argue this way: getpass() is not specified by a standard. > diff --git a/doc/glibc-functions/getpass.texi > b/doc/glibc-functions/getpass.texi > index b805cf5..561b89c 100644 > --- a/doc/glibc-functions/getpass.texi > +++ b/doc/glibc-functions/getpass.texi > @@ -6,6 +6,13 @@ Gnulib module: --- > > Portability problems fixed by Gnulib: > @itemize > [EMAIL PROTECTED] > +This implementation returns password of arbitrary length, other > +implementations truncate it to PASS_MAX or 8 characters. > [EMAIL PROTECTED] > +This implementation allocate the password using malloc, other > +implementations may return a pointer to a static buffer which must not > +be de-allocated. > @end itemize > The way you wrote it here, it is not clear which module provides "this implementation". The "Gnulib module" field is "---"... Can you change the "Gnulib module" field to "getpass or getpass-gnu" and then set up a 3-way structure like in doc/posix-functions/snprintf.texi? The goal is to make clear to the reader which module he needs if he wants a particular portability problem fixed. Another, minor point is: "This implementation returns password of arbitrary length" is incorrect English syntax for me. "a password"? "passwords"? Bruno