aboutsummaryrefslogtreecommitdiffstats
path: root/main/libnl/fix-strerror_r.patch
blob: ff129be721971a76b946e77ec5f2ecb394162f43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--- libnl-1.1.4.orig/lib/fib_lookup/lookup.c
+++ libnl-1.1.4/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;
 }
--- libnl-1.1.4.orig/lib/handlers.c
+++ libnl-1.1.4/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");
 
--- libnl-1.1.4.orig/lib/msg.c
+++ libnl-1.1.4/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);