void-packages/srcpkgs/uftrace/patches/strerror.patch
Đoàn Trần Công Danh 5769f150de srcpkgs/u*: 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

33 lines
826 B
Diff

--- a/utils/debug.c
+++ b/utils/debug.c
@@ -120,7 +120,7 @@
vfprintf(logfp, fmt, ap);
va_end(ap);
- fprintf(logfp, ": %s\n", strerror_r(saved_errno, buf, sizeof(buf)));
+ fprintf(logfp, ": %s\n", strerror(saved_errno));
color(TERM_COLOR_RESET, logfp);
--- a/libtraceevent/event-parse.c 2017-12-05 06:11:38.000000000 +0100
+++ b/libtraceevent/event-parse.c 2017-12-06 21:02:42.135421115 +0100
@@ -5353,12 +5353,19 @@
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
+ int rc = strerror_r(errnum, buf, buflen);
+ if (rc < 0) {
+ snprintf(buf, buflen, "Error %d", errnum);
+ }
+#endif
return 0;
}