aboutsummaryrefslogtreecommitdiffstats
path: root/main/powertop/strerror_r.patch
blob: cf8659e1e3aaefa8764ff38e3a1cf833f7877bce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--- traceevent/event-parse.c.orig
+++ ./traceevent/event-parse.c
@@ -5121,12 +5121,17 @@
 	const char *msg;
 
 	if (errnum >= 0) {
+#if defined(__GLIBC__)
 		msg = strerror_r(errnum, buf, buflen);
 		if (msg != buf) {
 			size_t len = strlen(msg);
 			memcpy(buf, msg, min(buflen - 1, len));
 			*(buf + min(buflen - 1, len)) = '\0';
 		}
+#else
+		if (strerror_r(errnum, buf, buflen))
+			snprintf(buf, buflen, "errnum %i", errnum);
+#endif
 		return 0;
 	}