[PATCH] Fix libstdc++/7811
Roland McGrath
roland@redhat.com
Thu Sep 5 11:19:00 GMT 2002
> I'm unsure about the following points: in case LC_ALL is not set is the
> fallback to LANG really needed (PR submitter implicitly expected this
> to be the case)? Also, if neither are set is always correct that "" -> "C"?
The standards specify looking at LC_ALL, then at the variable for the
particular category if setting just one, then at LANG. Note that a variable
that is present but empty (e.g. getenv("LC_ALL") => "") is treated as not
present. Off hand I am not sure if the behavior when none are set is
specified or is implementation-defined. Defaulting to "C" is safe and
consistent.
Another thing to note if you want to match the selection behavior of
setlocale is that if the name contains a slash and the program is setuid
then the name will be ignored and "C" used instead. (It doesn't check
this on each variable, just on the name chosen from any.)
More information about the Libstdc++
mailing list