summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2003-12-24 23:48:07 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2003-12-24 23:48:07 +0000
commitc78b6c41240257191ae3be8dc1e2d29109a7e76b (patch)
treeb1e613365dbfe1a41c8c7d84d360452a22c4cf32
parent47c312b4f6967df86d6174660cda5b5e313083db (diff)
syscalls return -1 on err so test for == -1 instead of the < 0 found in very
few places, requested by theo
-rw-r--r--usr.sbin/bgpd/config.c4
-rw-r--r--usr.sbin/bgpd/rde.c4
-rw-r--r--usr.sbin/bgpd/session.c12
3 files changed, 10 insertions, 10 deletions
diff --git a/usr.sbin/bgpd/config.c b/usr.sbin/bgpd/config.c
index 39a20243bad..43ac8594a7c 100644
--- a/usr.sbin/bgpd/config.c
+++ b/usr.sbin/bgpd/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.4 2003/12/24 13:49:21 henning Exp $ */
+/* $OpenBSD: config.c,v 1.5 2003/12/24 23:48:06 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -103,7 +103,7 @@ get_bgpid(void)
localnet = inet_addr("127.0.0.0");
- if (getifaddrs(&ifap) < 0)
+ if (getifaddrs(&ifap) == -1)
fatal("getifaddrs", errno);
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index fb4792d4c70..c73b2fdc027 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.27 2003/12/24 20:09:57 henning Exp $ */
+/* $OpenBSD: rde.c,v 1.28 2003/12/24 23:48:06 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -91,7 +91,7 @@ rde_main(struct bgpd_config *config, int pipe_m2r[2], int pipe_s2r[2])
if ((pw = getpwnam(BGPD_USER)) == NULL)
fatal("getpwnam", errno);
- if (chroot(pw->pw_dir) < 0)
+ if (chroot(pw->pw_dir) == -1)
fatal("chroot failed", errno);
chdir("/");
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index 8b99ee1981f..1f60fc08ddc 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.38 2003/12/24 23:14:23 henning Exp $ */
+/* $OpenBSD: session.c,v 1.39 2003/12/24 23:48:05 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -100,7 +100,7 @@ setup_listener(void)
{
int fd, opt;
- if ((fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
+ if ((fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1)
return (fd);
opt = 1;
@@ -144,14 +144,14 @@ session_main(struct bgpd_config *config, int pipe_m2s[2], int pipe_s2r[2])
if ((pw = getpwnam(BGPD_USER)) == NULL)
fatal(NULL, errno);
- if (chroot(pw->pw_dir) < 0)
+ if (chroot(pw->pw_dir) == -1)
fatal("chroot failed", errno);
chdir("/");
setproctitle("session engine");
bgpd_process = PROC_SE;
- if ((sock = setup_listener()) < 0)
+ if ((sock = setup_listener()) == -1)
fatal("listener setup failed", 0);
if (setgroups(1, &pw->pw_gid) ||
@@ -666,7 +666,7 @@ session_connect(struct peer *peer)
if (peer->sock != -1) /* what do we do here? */
return (-1);
- if ((peer->sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
+ if ((peer->sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
log_err(peer, "session_connect socket");
bgp_fsm(peer, EVNT_CON_OPENFAIL);
return (-1);
@@ -689,7 +689,7 @@ session_connect(struct peer *peer)
}
if ((n = connect(peer->sock, (struct sockaddr *)&peer->conf.remote_addr,
- sizeof(peer->conf.remote_addr))) < 0)
+ sizeof(peer->conf.remote_addr))) == -1)
if (errno != EINPROGRESS) {
log_err(peer, "connect");
bgp_fsm(peer, EVNT_CON_OPENFAIL);