getenv not thread safe

Jakub Jelinek jakub@redhat.com
Mon Aug 15 11:50:00 GMT 2005


On Mon, Aug 15, 2005 at 03:16:56AM -0700, Paul Orang wrote:
> http://blogs.sun.com/roller/page/pgdh/20050614 points
> out that glibc getenv is not protected against
> parallel setenvs. Can it be fixed?

getenv is not required to be thread-safe, see
http://www.opengroup.org/onlinepubs/009695399/functions/getenv.html
The string returned by getenv may become invalid after next
setenv/putenv/unsetenv call, so any program relying on thread-safety
of these is broken.

	Jakub



More information about the Libc-alpha mailing list