summaryrefslogtreecommitdiff
path: root/package/libnl/patches/patch-lib_utils_c
blob: 3d75f7487533b3e6015b6aead8159a45e924f126 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
--- libnl-libnl3_2_29.orig/lib/utils.c	Fri Dec 30 15:57:01 2016
+++ libnl-libnl3_2_29/lib/utils.c	Sat Jan 13 09:58:56 2024
@@ -30,7 +30,9 @@
 #include <netlink/utils.h>
 #include <linux/socket.h>
 #include <stdlib.h> /* exit() */
+#ifdef HAVE_STRERROR_L
 #include <locale.h>
+#endif
 
 /**
  * Global variable indicating the desired level of debugging output.
@@ -123,9 +125,10 @@ int __nl_read_num_str_file(const char *path, int (*cb)
 
 const char *nl_strerror_l(int err)
 {
+	const char *buf;
+#ifdef HAVE_STRERROR_L
 	int errno_save = errno;
 	locale_t loc = newlocale(LC_MESSAGES_MASK, "", (locale_t)0);
-	const char *buf;
 
 	if (loc == (locale_t)0) {
 		if (errno == ENOENT)
@@ -140,6 +143,9 @@ const char *nl_strerror_l(int err)
 	}
 
 	errno = errno_save;
+#else
+	buf = strerror(err);
+#endif
 	return buf;
 }
 /** @endcond */