[google] Handle NULL return values in setlocale calls (issue4444046)

Paolo Carlini paolo.carlini@oracle.com
Sun Apr 17 12:25:00 GMT 2011


Hi,
> Thanks Diego for committing this patch.
>
> Yes, I would like to submit the patch to trunk. The reason is for this
> patch is that setlocale() in bionicC always returns NULL (bionicC does
> not support setlocale()), however libstdc++ does not handle the NULL
> return value of setlocale(xxx,NULL) and thus causes segmentation
> fault.
The patch makes sense and I'm ok with it if you add a short comment 
explaining the issue, which we never encountered before. Of course, 
longer term we (you ;) may want to add to the library a 4th locale model 
beyond the existing ones, some sort of dummy locale model meant for 
targets like bionicC, which essentially don't provide locales at all, if 
I understand correctly: without a working setlocale how can you switch 
from one named locale to another in portable C code?

Paolo.



More information about the Libstdc++ mailing list