Making getenv more multi-threading--robust?
Mike Frysinger
vapier@gentoo.org
Mon Sep 17 18:47:00 GMT 2012
On Thursday 13 September 2012 06:56:47 Stephan Bergmann wrote:
> --- a/stdlib/getenv.c
> +++ b/stdlib/getenv.c
> @@ -37,8 +38,13 @@ getenv (name)
> char **ep;
> uint16_t name_start;
>
> + LOCK;
> +
> if (__environ == NULL || name[0] == '\0')
> - return NULL;
> + {
> + UNLOCK;
> + return NULL;
> + }
i don't think you need to grab the lock this early ... certainly don't want to
hold the lock while validating the inputs
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20120917/bc68ce21/attachment.sig>
More information about the Libc-alpha
mailing list