summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mrinfo
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/mrinfo
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/mrinfo')
-rw-r--r--usr.sbin/mrinfo/mrinfo.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/mrinfo/mrinfo.c b/usr.sbin/mrinfo/mrinfo.c
index c1f70d9723d..47c51854153 100644
--- a/usr.sbin/mrinfo/mrinfo.c
+++ b/usr.sbin/mrinfo/mrinfo.c
@@ -375,9 +375,9 @@ main(int argc, char *argv[])
addr.sin_addr.s_addr = target_addr;
addr.sin_port = htons(2000); /* any port over 1024 will
* do... */
- if ((udp = socket(AF_INET, SOCK_DGRAM, 0)) < 0 ||
- connect(udp, (struct sockaddr *) & addr, sizeof(addr)) < 0 ||
- getsockname(udp, (struct sockaddr *) & addr, &addrlen) < 0) {
+ if ((udp = socket(AF_INET, SOCK_DGRAM, 0)) == -1 ||
+ connect(udp, (struct sockaddr *) & addr, sizeof(addr)) == -1 ||
+ getsockname(udp, (struct sockaddr *) & addr, &addrlen) == -1) {
perror("Determining local address");
exit(1);
}
@@ -422,7 +422,7 @@ main(int argc, char *argv[])
count = poll(pfd, 1, tv.tv_sec * 1000);
- if (count < 0) {
+ if (count == -1) {
if (errno != EINTR)
perror("select");
continue;