Re: [gtk-list] Re: still a bug with getpwuid_r [was: Re: 1.1.14
- From: Kevin Cozens <kcozens interlog com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: still a bug with getpwuid_r [was: Re: 1.1.14
- Date: Tue, 02 Feb 1999 16:04:11 -0500
At 02:49 PM 02/02/1999 +0100, you wrote:
>> Doubled by whom?
>
>By glib: here's the source:
>
> do
> {
> g_free (buffer);
> buffer = g_malloc (bufsize);
>
># ifdef HAVE_GETPWUID_R_POSIX
> error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw);
> error = error < 0 ? errno : error;
># else /* !HAVE_GETPWUID_R_POSIX */
> pw = getpwuid_r (getuid (), &pwd, buffer, bufsize);
> error = pw ? 0 : errno;
># endif /* !HAVE_GETPWUID_R_POSIX */
>
> bufsize *= 2; /* here the bufzise gets doubled */
> }
> while (error == ERANGE); /* This loop us left, whenever the call
> to getpwuid succeded. */
>
>
>> Don't forget that we are working on multiple
>> architectures, and the Digital UNIX man page seems very specific.
>>
>> I'd rather have it suffice in all situations rather than most.
>
>I still think, it should work on DIGITAL as well.
This seems to be an awful hack. Surely there must be a better way to
determine the size of the buffer that is needed. I can picture g_malloc
returning NULL when there isn't enough memory to allocate the buffer. The
getpwuid_r() call assumes that the g_malloc() call succeeded. If it didn't
it would seem to me that you have a big problem just waiting to happen.
This might be ok for now until a better way is found. I don't think you
want this in the 1.2 version of glib.
Cheers!
Kevin. (http://www.interlog.com/~kcozens/)
Internet:kcozens at interlog.com |"What are we going to do today, Borg?"
or:ve3syb at rac.ca |"Same thing we always do, Pinkutus:
Packet:ve3syb@va3bbs.#scon.on.ca.na| Try to assimilate the world!"
#include <disclaimer/favourite> | -Pinkutus & the Borg
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]