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: [PATCH] Make fmtmsg() function to multithread-safe


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


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