[PATCH] Make fmtmsg() function to multithread-safe

Tolga Dalman tolga.dalman@googlemail.com
Tue Feb 21 10:31:00 GMT 2012


Hi,

> +  const char *pstring;
> 
> /* Make sure everything is initialized.  */ __libc_once (once, 
> init); @@ -124,11 +125,18 @@ fmtmsg (long int classification,
> const
char *label, int severity,
> return MM_NOTOK; }
> 
> +  __libc_lock_lock (lock); + for (severity_rec = severity_list; 
> severity_rec != NULL; severity_rec = severity_rec->next) if 
> (severity == severity_rec->severity) +    { +      pstring = 
> severity_rec->string; /* Bingo.  */ break; +    }

This makes me a bit nervous. pstring is undefined if the inner
condition never matches.

Best regards
Tolga Dalman



More information about the Libc-alpha mailing list