about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-11-10 23:07:17 -0500
committerRich Felker <dalias@aerifal.cx>2015-11-10 23:07:17 -0500
commita946e8117ed51dd771bd8cac3575fc28a0399a32 (patch)
tree4d988375f0ba2d8cd738ee6087fcd337ac67c1e3
parent4e73d12117e362ad4b82946dc084b4a38f76e54b (diff)
downloadmusl-a946e8117ed51dd771bd8cac3575fc28a0399a32.tar.gz
musl-a946e8117ed51dd771bd8cac3575fc28a0399a32.tar.xz
musl-a946e8117ed51dd771bd8cac3575fc28a0399a32.zip
fix return value of nl_langinfo for invalid item arguments
it was wrongly returning a null pointer instead of an empty string.
-rw-r--r--src/locale/langinfo.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/locale/langinfo.c b/src/locale/langinfo.c
index d3c90d96..b2c8569e 100644
--- a/src/locale/langinfo.c
+++ b/src/locale/langinfo.c
@@ -37,23 +37,23 @@ char *__nl_langinfo_l(nl_item item, locale_t loc)
 	
 	switch (cat) {
 	case LC_NUMERIC:
-		if (idx > 1) return NULL;
+		if (idx > 1) return "";
 		str = c_numeric;
 		break;
 	case LC_TIME:
-		if (idx > 0x31) return NULL;
+		if (idx > 0x31) return "";
 		str = c_time;
 		break;
 	case LC_MONETARY:
-		if (idx > 0) return NULL;
+		if (idx > 0) return "";
 		str = "";
 		break;
 	case LC_MESSAGES:
-		if (idx > 3) return NULL;
+		if (idx > 3) return "";
 		str = c_messages;
 		break;
 	default:
-		return NULL;
+		return "";
 	}
 
 	for (; idx; idx--, str++) for (; *str; str++);