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
>Organization:
        
>Environment:
        
        
System: NetBSD ns.back-street.net 5.0_STABLE NetBSD 5.0_STABLE (EPIA) #36: Sun 
Sep 20 17:05:18 JST 2009 
taca%boy.a.back-street.net@localhost:/data/i386/obj5/sys/arch/i386/compile/EPIA 
i386
Architecture: i386
Machine: i386
>Description:
        setlocale(3) says:

  RETURN VALUES
       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".

>How-To-Repeat:
        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>

main()
{
        char *lc;

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

>Fix:
        Unknown.

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index