• Tom Lane's avatar
    Second try at getting useful errors out of newlocale/_create_locale. · 514f6132
    Tom Lane authored
    The early buildfarm returns for commit 1e165d05 are pretty awful:
    not only does Windows not return a useful error, but it looks like
    a lot of Unix-ish platforms don't either.  Given the number of
    different errnos seen so far, guess that what's really going on is
    that some newlocale() implementations fail to set errno at all.
    Hence, let's try zeroing errno just before newlocale() and then
    if it's still zero report as though it's ENOENT.  That should cover
    the Windows case too.
    
    It's clear that we'll have to drop the regression test case, unless
    we want to maintain a separate expected-file for platforms without
    HAVE_LOCALE_T.  But I'll leave it there awhile longer to see if this
    actually improves matters or not.
    
    Discussion: https://postgr.es/m/CAKKotZS-wcDcofXDCH=sidiuajE+nqHn2CGjLLX78anyDmi3gQ@mail.gmail.com
    514f6132
pg_locale.c 50.4 KB