The C standard says (C23 K.3.6.2.1):
The getenv_s function returns zero if the specified name is found and the 
associated string was successfully stored in value . Otherwise, a nonzero value 
is returned
However getenv_s in the UCRT reports success (return value is 0) for 
non-exisiting environment variables:

#include <windows.h>
#include <stdlib.h>
#include <assert.h>

int
main (void)
{
    char value[100];
    size_t len;
    errno_t ret;

    ret = getenv_s (&len, value, sizeof (value), "NONEXISTING");
    assert (ret != 0);
}

Should we provide a wrapper?

Best Regards,
Luca

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to