void-packages/srcpkgs/libcgroup/patches/musl-strerror_r.patch

23 lines
603 B
Diff

The musl libc strerror_r(3) semantics are different from
GNU libc's if _GNU_SOURCE is defined.
--- src/api.c 2014-01-13 15:05:56.000000000 +0100
+++ src/api.c 2015-10-25 14:09:18.690232596 +0100
@@ -3332,8 +3332,16 @@
const char *cgroup_strerror(int code)
{
+#if defined(__GLIBC__)
if (code == ECGOTHER)
return strerror_r(cgroup_get_last_errno(), errtext, MAXLEN);
+#else
+ if (code == ECGOTHER) {
+ if (0 == strerror_r(cgroup_get_last_errno(), errtext, MAXLEN))
+ return errtext;
+ return "strerror_r() failed";
+ }
+#endif
return cgroup_strerror_codes[code % ECGROUPNOTCOMPILED];
}