void-packages/srcpkgs/libcgroup/patches/musl-strerror_r.patch
Đoàn Trần Công Danh 861ac185a6 srcpkgs/l*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

23 lines
607 B
Diff

The musl libc strerror_r(3) semantics are different from
GNU libc's if _GNU_SOURCE is defined.
--- a/src/api.c 2014-01-13 15:05:56.000000000 +0100
+++ b/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];
}