apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe Jr." <wr...@rowe-clan.net>
Subject Re: Fwd: [PATCH] apr_pstrdup value returned by apr_env_get
Date Mon, 12 Sep 2011 09:45:30 GMT
On 9/12/2011 2:38 AM, Ignaz Birnstingl wrote:
> I guess the patch didn't make it to trunk so I'll restate why I think
> this should make it to future versions of APR:
> -) The documentation says about argument pool: "where to allocate
> value and any temporary storage from". If *value is not allocated from
> pool then manipulating the data pointed to it can have any kinds of
> side-effects.
> -) The single UNIX specification states that getenv() "need not be
> reentrant" and in fact it is not on some platforms, like the z/OS USS.
> Thus apr_env_get is not reentrant on some platforms. Even with my
> patch the documentation should probably state that the function is not
> thread-safe and requires external serialization.

[un]setenv/putenv are never thread safe.  You are confusing the issues,
if the environment is volatile after threads are created the code is
broken.

Your 'fix' has a race condition and is therefore not the solution.


Mime
View raw message