Oops I did miss that.
Sorry for the noise.

- Julien

Le 25 juil. 2016 à 11:46, Alexander Monakov <amonakov@ispras.ru> a écrit :

On Mon, 25 Jul 2016, Julien Ramseier wrote:
As per POSIX, newlocale() should set errno when it fails.

---
src/locale/newlocale.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/src/locale/newlocale.c b/src/locale/newlocale.c
index f50bbe9..2bfb832 100644
--- a/src/locale/newlocale.c
+++ b/src/locale/newlocale.c
@@ -1,3 +1,4 @@
+#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "locale_impl.h"
@@ -42,6 +43,7 @@ locale_t __newlocale(int mask, const char *name, locale_t loc)
return UTF8_LOCALE;

if ((loc = malloc(sizeof *loc))) *loc = tmp;
+ else errno = ENOMEM;

When malloc returns NULL, it will set errno to ENOMEM; there's no need for
callers to handle that separately.

Did you hit some issue in practice that prompted this change?

Alexander