Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <52B93B58-3345-45E1-B108-C68AA212952F@gmail.com>
Date: Mon, 25 Jul 2016 11:35:55 +0200
From: Julien Ramseier <j.ramseier@...il.com>
To: musl@...ts.openwall.com
Subject: [PATCH] newlocale: set errno on failure

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;

 	return loc;
 }
--
2.9.2

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.