summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ospfd/interface.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/ospfd/interface.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/ospfd/interface.c')
-rw-r--r--usr.sbin/ospfd/interface.c14
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);
}