Re: [gtk-list] Re: still a bug with getpwuid_r [was: Re: 1.1.14



> From: Sebastian Wilhelmi <wilhelmi@ira.uka.de>
> 
> Dave Reed wrote:
> > =
> 
> > I'm not so certain.  Why does my program crash in gtk_init when the
> > line is as below, but is ok when the commented out code is used?
> > =
> 
> >  guint bufsize =3D 1; /* sizeof (struct passwd); */
> 
> First the sizeof (struct passwd) is wrong here (it was however my fault,
> that this came into the source ;-( ). the buffer is used for the strings
> that are pointed to by struct passwd, not the struct itself. So, to use 1=

Yes, I did get that from the man page.

> is actually very nasty, but nonetheless valid according to the
> descripition of the function, but some C-libraries seem to assume a
> bufsize of at least 2. Do not ask why, thats the way it is.

Ok, so use 2 instead of 1 - or better yet, what a reasonable value
would be so that the loop doesn't execute very many times - the
rationale for at least (8 + 25 + 25 + 1) and using 64 made sense to
me.

> Bye, =
> 
> Sebastian

Thanks for checking into this.

Dave



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]