Skip to contentSkip to conversation

batctl: Fix error message when tcpdump packet sent failed

PATCH New Sven Eckelmann 1 participant 1 message Jul 5, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 batctl: Fix error message when tcpdump packet sent failed

The strerror converts the positive error code into a string. tcpdump must therefore convert the negative return code from icmp_interface_write into a positive one before using it as parameter for strerror.

---
 traceroute.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
traceroute.c +1 -1
index 124ce7c..79d3800 100644
@@ -150,7 +150,7 @@ int traceroute(char *mesh_iface, int argc, char **argv)
 					   (struct batadv_icmp_header *)&icmp_packet_out,
 					   sizeof(icmp_packet_out));
 			if (res < 0) {
-				fprintf(stderr, "Error - can't send icmp packet: %s\n", strerror(res));
+				fprintf(stderr, "Error - can't send icmp packet: %s\n", strerror(-res));
 				continue;
 			}
 
Signature · 1 line
2.11.0