This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Make fmtmsg() function to multithread-safe
- From: Tolga Dalman <tolga dot dalman at googlemail dot com>
- To: libc-alpha at sourceware dot org
- Date: Tue, 21 Feb 2012 11:30:59 +0100
- Subject: Re: [PATCH] Make fmtmsg() function to multithread-safe
- Authentication-results: mr.google.com; spf=pass (google.com: domain of tolga.dalman@googlemail.com designates 10.204.130.129 as permitted sender) smtp.mail=tolga.dalman@googlemail.com; dkim=pass header.i=tolga.dalman@googlemail.com
- References: <4F43618A.8030009@cn.fujitsu.com>
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