void-packages/srcpkgs/libnl/patches/fix-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

50 lines
1.6 KiB
Diff

--- a/lib/fib_lookup/lookup.c
+++ b/lib/fib_lookup/lookup.c
@@ -124,7 +124,7 @@
static int result_dump_brief(struct nl_object *obj, struct nl_dump_params *p)
{
struct flnl_result *res = (struct flnl_result *) obj;
- char buf[256];
+ char buf[256], buf2[256];
int line = 1;
dp_dump(p, "table %s prefixlen %u next-hop-selector %u\n",
@@ -132,9 +132,10 @@
res->fr_prefixlen, res->fr_nh_sel);
dp_dump_line(p, line++, "type %s ",
nl_rtntype2str(res->fr_type, buf, sizeof(buf)));
+ strerror_r(-res->fr_error, buf2, sizeof(buf2));
dp_dump(p, "scope %s error %s (%d)\n",
rtnl_scope2str(res->fr_scope, buf, sizeof(buf)),
- strerror_r(-res->fr_error, buf, sizeof(buf)), res->fr_error);
+ buf2, res->fr_error);
return line;
}
--- a/lib/handlers.c
+++ b/lib/handlers.c
@@ -136,8 +136,8 @@
FILE *ofd = arg ? arg : stderr;
char buf[256];
- fprintf(ofd, "-- Error received: %s\n-- Original message: ",
- strerror_r(-e->error, buf, sizeof(buf)));
+ strerror_r(-e->error, buf, sizeof(buf));
+ fprintf(ofd, "-- Error received: %s\n-- Original message: ", buf);
print_header_content(ofd, &e->msg);
fprintf(ofd, "\n");
--- a/lib/msg.c
+++ b/lib/msg.c
@@ -961,9 +961,9 @@
struct nlmsgerr *err = nlmsg_data(hdr);
char buf[256];
+ strerror_r(-err->error, buf, sizeof(buf));
fprintf(ofd, " [ERRORMSG] %Zu octets\n", sizeof(*err));
- fprintf(ofd, " .error = %d \"%s\"\n", err->error,
- strerror_r(-err->error, buf, sizeof(buf)));
+ fprintf(ofd, " .error = %d \"%s\"\n", err->error, buf);
fprintf(ofd, " [ORIGINAL MESSAGE] %Zu octets\n", sizeof(*hdr));
errmsg = nlmsg_inherit(&err->msg);