summaryrefslogtreecommitdiff
path: root/sbin/pflogd
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-28 13:32:54 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-28 13:32:54 +0000
commit86ffccf24f66032a89d70a32b3609584c0db7345 (patch)
tree2ae97fac6ea5be57cc953baf8612e8f683da0172 /sbin/pflogd
parentce9fea47562d4f179d45680d6aec00ede2877141 (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 'sbin/pflogd')
-rw-r--r--sbin/pflogd/pflogd.c4
-rw-r--r--sbin/pflogd/privsep.c6
2 files changed, 5 insertions, 5 deletions
diff --git a/sbin/pflogd/pflogd.c b/sbin/pflogd/pflogd.c
index e855bab910f..b8a8c8ae544 100644
--- a/sbin/pflogd/pflogd.c
+++ b/sbin/pflogd/pflogd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pflogd.c,v 1.59 2018/08/26 18:24:46 brynet Exp $ */
+/* $OpenBSD: pflogd.c,v 1.60 2019/06/28 13:32:45 deraadt Exp $ */
/*
* Copyright (c) 2001 Theo de Raadt
@@ -213,7 +213,7 @@ init_pcap(void)
set_pcap_filter();
/* lock */
- if (ioctl(pcap_fileno(hpcap), BIOCLOCK) < 0) {
+ if (ioctl(pcap_fileno(hpcap), BIOCLOCK) == -1) {
logmsg(LOG_ERR, "BIOCLOCK: %s", strerror(errno));
return (-1);
}
diff --git a/sbin/pflogd/privsep.c b/sbin/pflogd/privsep.c
index c0549727356..36cc0395f1d 100644
--- a/sbin/pflogd/privsep.c
+++ b/sbin/pflogd/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.32 2018/08/26 18:26:51 brynet Exp $ */
+/* $OpenBSD: privsep.c,v 1.33 2019/06/28 13:32:45 deraadt Exp $ */
/*
* Copyright (c) 2003 Can Erkin Acar
@@ -99,7 +99,7 @@ priv_init(int Pflag, int argc, char *argv[])
err(1, "socketpair() failed");
child_pid = fork();
- if (child_pid < 0)
+ if (child_pid == -1)
err(1, "fork() failed");
if (!child_pid) {
@@ -200,7 +200,7 @@ BROKEN if (pledge("stdio rpath wpath cpath sendfd proc bpf", NULL) == -1)
0600);
olderrno = errno;
send_fd(socks[0], bpfd);
- if (bpfd < 0)
+ if (bpfd == -1)
logmsg(LOG_NOTICE,
"[priv]: failed to open %s: %s",
filename, strerror(olderrno));