NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/42124: setlocale(3) never returns NULL with none existing locale.

>Number:         42124
>Category:       lib
>Synopsis:       setlocale(3) never returns NULL with none existing locale.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 25 02:30:00 +0000 2009
>Originator:     Takahiro Kambe
>Release:        NetBSD 5.0_STABLE
System: NetBSD 5.0_STABLE NetBSD 5.0_STABLE (EPIA) #36: Sun 
Sep 20 17:05:18 JST 2009 
Architecture: i386
Machine: i386
        setlocale(3) says:

       The setlocale() function returns NULL and fails to change the locale if
       the given combination of category and locale makes no sense.  ...

        But it seems that setlocale() always return "C".

        Compile and execute below code:

        $ env LANG=foo ./a.out
        setlocale() retunrs "C".

        Even if changing second argument of setlocale() to "foo" cause
        the same result.

        The same code on NetBSD 4.0_STABLE returns expected result.

        $ env LANG=foo ./a.out
        setlocale() retunrs "NULL".

#include <stdio.h>
#include <locale.h>

        char *lc;

        lc = setlocale(LC_ALL, "");
        printf("setlocale() retunrs \"%s\".\n", (lc == NULL)? "NULL": lc);



Home | Main Index | Thread Index | Old Index