locale.c: Account for setlocale using static storage

Some systems setlocale()s use static storage for the locale name
returned by it, so that a subsequent setlocale overwrites it.
Therefore, you must make a copy of the name if you want it to work after
the next setlocale.

Thanks to Craig Berry for finding and diagnosing this problem.