This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/13271] getaddrinfo is not thread safe
- From: "bugdal at aerifal dot cx" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Fri, 07 Oct 2011 16:29:26 +0000
- Subject: [Bug libc/13271] getaddrinfo is not thread safe
- Auto-submitted: auto-generated
- References: <bug-13271-131@http.sourceware.org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=13271
--- Comment #4 from Rich Felker <bugdal at aerifal dot cx> 2011-10-07 16:29:26 UTC ---
2.9.1 states very explicitly, "any function dependent on any
environment variable is not thread-safe if another thread is modifying the
environment". The only potential wiggle-room to claim that glibc is
non-conformant is that getaddrinfo is not documented (by the standard or by the
implementation) as depending on the environment.
With that said, I agree that Ulrich Drepper is wrong to claim that modifying
the environment in a multi-threaded program is not allowed. It can be done
safely in many situations, such as when all but one thread is purely
computational or only invoking only async-signal-safe functions. It should also
be perfectly safe if you modify extern char **environ; (or the array it points
to) directly in only atomic ways and don't clobber any environment memory that
other threads could still be referencing.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.