This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Making getenv more multi-threading--robust?


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

Attachment: signature.asc
Description: This is a digitally signed message part.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]