From: Julien Ramseier <j.ramseier@gmail.com>
To: musl@lists.openwall.com
Subject: [PATCH] newlocale: set errno on failure
Date: Mon, 25 Jul 2016 11:35:55 +0200 [thread overview]
Message-ID: <52B93B58-3345-45E1-B108-C68AA212952F@gmail.com> (raw)
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
next reply other threads:[~2016-07-25 9:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-25 9:35 Julien Ramseier [this message]
2016-07-25 9:46 ` Alexander Monakov
2016-07-25 9:48 ` Julien Ramseier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52B93B58-3345-45E1-B108-C68AA212952F@gmail.com \
--to=j.ramseier@gmail.com \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).