summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/ssh-keyscan.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2019-06-28 13:34:58 +0000
committerderaadt <deraadt@openbsd.org>2019-06-28 13:34:58 +0000
commit3aaa63eb46949490a39db9c6d82aacc8ee5d8551 (patch)
treeef48ea58ad350ab9d01fbfe32455a1df1fa2340c /usr.bin/ssh/ssh-keyscan.c
parentfputc/fputs return EOF on error (diff)
downloadwireguard-openbsd-3aaa63eb46949490a39db9c6d82aacc8ee5d8551.tar.xz
wireguard-openbsd-3aaa63eb46949490a39db9c6d82aacc8ee5d8551.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.bin/ssh/ssh-keyscan.c')
-rw-r--r--usr.bin/ssh/ssh-keyscan.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/ssh/ssh-keyscan.c b/usr.bin/ssh/ssh-keyscan.c
index d21140b326a..735d4713b27 100644
--- a/usr.bin/ssh/ssh-keyscan.c
+++ b/usr.bin/ssh/ssh-keyscan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keyscan.c,v 1.127 2019/06/06 05:13:13 otto Exp $ */
+/* $OpenBSD: ssh-keyscan.c,v 1.128 2019/06/28 13:35:04 deraadt Exp $ */
/*
* Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
*
@@ -115,7 +115,7 @@ fdlim_get(int hard)
{
struct rlimit rlfd;
- if (getrlimit(RLIMIT_NOFILE, &rlfd) < 0)
+ if (getrlimit(RLIMIT_NOFILE, &rlfd) == -1)
return (-1);
if ((hard ? rlfd.rlim_max : rlfd.rlim_cur) == RLIM_INFINITY)
return sysconf(_SC_OPEN_MAX);
@@ -130,10 +130,10 @@ fdlim_set(int lim)
if (lim <= 0)
return (-1);
- if (getrlimit(RLIMIT_NOFILE, &rlfd) < 0)
+ if (getrlimit(RLIMIT_NOFILE, &rlfd) == -1)
return (-1);
rlfd.rlim_cur = lim;
- if (setrlimit(RLIMIT_NOFILE, &rlfd) < 0)
+ if (setrlimit(RLIMIT_NOFILE, &rlfd) == -1)
return (-1);
return (0);
}
@@ -325,13 +325,13 @@ tcpconnect(char *host)
}
for (ai = aitop; ai; ai = ai->ai_next) {
s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
- if (s < 0) {
+ if (s == -1) {
error("socket: %s", strerror(errno));
continue;
}
if (set_nonblock(s) == -1)
fatal("%s: set_nonblock(%d)", __func__, s);
- if (connect(s, ai->ai_addr, ai->ai_addrlen) < 0 &&
+ if (connect(s, ai->ai_addr, ai->ai_addrlen) == -1 &&
errno != EINPROGRESS)
error("connect (`%s'): %s", host, strerror(errno));
else