Subject: Re: getpwent(3) funcs return static structure
To: Greg Oster <oster@cs.usask.ca>
From: Rick Byers <rickb@iaw.on.ca>
List: current-users
Date: 03/02/1997 12:52:19
Thanks Greg, I guess I should look more carefully at the man pages next
time. :)
Rick
On Sat, 1 Mar 1997, Greg Oster wrote:
>
> Hi
>
> rickb@iaw.on.ca writes:
> > Hi...
> > I found out (the hard way) that the getpwent set of functions return a
> > pointer to a static structure (as opposed to one that has been freshly
> > allocated). Is this a good idea? Shouldn't it atleast be mentioned in
> > the man pages?
>
> This is from a -current manpage for getpwent/3:
>
> BUGS
> The functions getpwent(), getpwnam(), and getpwuid(), leave their results
> in an internal static object and return a pointer to that object. Subse-
> quent calls to the same function will modify the same object.
>
> Obviously the author of the above agrees with you :-)
>
> Later...
>
> Greg Oster
>
> oster@cs.usask.ca
> Department of Computer Science
> University of Saskatchewan, Saskatoon, Saskatchewan, CANADA
>
>
=========================================================================
Rick Byers Internet Access Worldwide
rickb@iaw.on.ca System Administrator
Welland, Ontario, Canada (905)714-1400
http://www.iaw.on.ca/rickb/ http://www.iaw.on.ca/