summaryrefslogtreecommitdiffstats
path: root/usr.sbin/traceroute/worker.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2019-06-28 13:32:41 +0000
committerderaadt <deraadt@openbsd.org>2019-06-28 13:32:41 +0000
commitdf69c215c7c66baf660f3f65414fd34796c96152 (patch)
tree0255639162b24c4a2f761a274e32b69c2256fd45 /usr.sbin/traceroute/worker.c
parentminiroot prototype disklabels should attempt to contain accurate (diff)
downloadwireguard-openbsd-df69c215c7c66baf660f3f65414fd34796c96152.tar.xz
wireguard-openbsd-df69c215c7c66baf660f3f65414fd34796c96152.zip
When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
Diffstat (limited to 'usr.sbin/traceroute/worker.c')
-rw-r--r--usr.sbin/traceroute/worker.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/traceroute/worker.c b/usr.sbin/traceroute/worker.c
index 92979359c21..e56bf59dff1 100644
--- a/usr.sbin/traceroute/worker.c
+++ b/usr.sbin/traceroute/worker.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: worker.c,v 1.5 2017/08/03 17:36:06 florian Exp $ */
+/* $OpenBSD: worker.c,v 1.6 2019/06/28 13:32:51 deraadt Exp $ */
/* $NetBSD: traceroute.c,v 1.10 1995/05/21 15:50:45 mycroft Exp $ */
/*
@@ -324,7 +324,7 @@ build_probe6(struct tr_conf *conf, int seq, u_int8_t hops, int iflag,
i = hops;
if (setsockopt(sndsock, IPPROTO_IPV6, IPV6_UNICAST_HOPS,
- (char *)&i, sizeof(i)) < 0)
+ (char *)&i, sizeof(i)) == -1)
warn("setsockopt IPV6_UNICAST_HOPS");
if (iflag)
@@ -373,8 +373,8 @@ send_probe(struct tr_conf *conf, int seq, u_int8_t ttl, int iflag,
dump_packet();
i = sendto(sndsock, outpacket, datalen, 0, to, to->sa_len);
- if (i < 0 || i != datalen) {
- if (i < 0)
+ if (i == -1 || i != datalen) {
+ if (i == -1)
warn("sendto");
printf("%s: wrote %s %d chars, ret=%d\n", __progname, hostname,
datalen, i);