void-packages/srcpkgs/libnl/patches/fix-strerror_r.patch

51 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);