aboutsummaryrefslogtreecommitdiffstats
path: root/main/powertop/strerror_r.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/powertop/strerror_r.patch')
-rw-r--r--main/powertop/strerror_r.patch20
1 files changed, 20 insertions, 0 deletions
diff --git a/main/powertop/strerror_r.patch b/main/powertop/strerror_r.patch
new file mode 100644
index 0000000000..cf8659e1e3
--- /dev/null
+++ b/main/powertop/strerror_r.patch
@@ -0,0 +1,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;
+ }
+