diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 13:32:54 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 13:32:54 +0000 |
commit | 86ffccf24f66032a89d70a32b3609584c0db7345 (patch) | |
tree | 2ae97fac6ea5be57cc953baf8612e8f683da0172 /usr.sbin/ospfd | |
parent | ce9fea47562d4f179d45680d6aec00ede2877141 (diff) |
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/ospfd')
-rw-r--r-- | usr.sbin/ospfd/interface.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.sbin/ospfd/interface.c b/usr.sbin/ospfd/interface.c index 57a9ce2f01d..1d966f34b59 100644 --- a/usr.sbin/ospfd/interface.c +++ b/usr.sbin/ospfd/interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: interface.c,v 1.82 2018/03/11 13:16:49 claudio Exp $ */ +/* $OpenBSD: interface.c,v 1.83 2019/06/28 13:32:49 deraadt Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -663,7 +663,7 @@ int if_set_recvif(int fd, int enable) { if (setsockopt(fd, IPPROTO_IP, IP_RECVIF, &enable, - sizeof(enable)) < 0) { + sizeof(enable)) == -1) { log_warn("if_set_recvif: error setting IP_RECVIF"); return (-1); } @@ -734,7 +734,7 @@ if_join_group(struct iface *iface, struct in_addr *addr) mreq.imr_interface.s_addr = iface->addr.s_addr; if (setsockopt(iface->fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, - (void *)&mreq, sizeof(mreq)) < 0) { + (void *)&mreq, sizeof(mreq)) == -1) { log_warn("if_join_group: error IP_ADD_MEMBERSHIP, " "interface %s address %s", iface->name, inet_ntoa(*addr)); @@ -782,7 +782,7 @@ if_leave_group(struct iface *iface, struct in_addr *addr) mreq.imr_interface.s_addr = iface->addr.s_addr; if (setsockopt(iface->fd, IPPROTO_IP, IP_DROP_MEMBERSHIP, - (void *)&mreq, sizeof(mreq)) < 0) { + (void *)&mreq, sizeof(mreq)) == -1) { log_warn("if_leave_group: error IP_DROP_MEMBERSHIP, " "interface %s address %s", iface->name, inet_ntoa(*addr)); @@ -809,7 +809,7 @@ if_set_mcast(struct iface *iface) case IF_TYPE_POINTOPOINT: case IF_TYPE_BROADCAST: if (setsockopt(iface->fd, IPPROTO_IP, IP_MULTICAST_IF, - &iface->addr.s_addr, sizeof(iface->addr.s_addr)) < 0) { + &iface->addr.s_addr, sizeof(iface->addr.s_addr)) == -1) { log_warn("if_set_mcast: error setting " "IP_MULTICAST_IF, interface %s", iface->name); return (-1); @@ -834,7 +834,7 @@ if_set_mcast_loop(int fd) u_int8_t loop = 0; if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, - (char *)&loop, sizeof(loop)) < 0) { + (char *)&loop, sizeof(loop)) == -1) { log_warn("if_set_mcast_loop: error setting IP_MULTICAST_LOOP"); return (-1); } @@ -847,7 +847,7 @@ if_set_ip_hdrincl(int fd) { int hincl = 1; - if (setsockopt(fd, IPPROTO_IP, IP_HDRINCL, &hincl, sizeof(hincl)) < 0) { + if (setsockopt(fd, IPPROTO_IP, IP_HDRINCL, &hincl, sizeof(hincl)) == -1) { log_warn("if_set_ip_hdrincl: error setting IP_HDRINCL"); return (-1); } |