vp-build/srcpkgs/libnl/patches/fix-strerror_r.patch

51 lines
1.6 KiB
Diff

--- lib/fib_lookup/lookup.c
+++ 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;
}
--- lib/handlers.c
+++ 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");
--- lib/msg.c
+++ 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);