Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170318143954.GP1693@brightrain.aerifal.cx>
Date: Sat, 18 Mar 2017 10:39:54 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: [setlocale]: return only one copy if all six parts of
 locale are same

On Sat, Mar 18, 2017 at 09:48:41PM +0800, He X wrote:
> oops, i missed UNLOCK(lock).
> 
> [...]
> >>
> >> I think the results of this patch can be achieved much more simply.
> >> Just compare lm pointers (rather than string contents) for equality at
> >> each iteration in the current loop, counting how many were equal to
> >> libc.global_locale.cat[0]. If that number equals LC_ALL, return
> >> libc.global_locale.cat[0]->name (or "C" if the lm is null) rather than
> >> buf.
> >>
> >> Rich
> >>
> >
> >

By simpler I meant something like the attached.

Rich

View attachment "setlocale.diff" of type "text/plain" (775 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.