summaryrefslogtreecommitdiff
path: root/ssh-keyscan.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-keyscan.c')
-rw-r--r--ssh-keyscan.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index 7b7c0f320..d95ba1b37 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-keyscan.c,v 1.127 2019/06/06 05:13:13 otto Exp $ */ 1/* $OpenBSD: ssh-keyscan.c,v 1.128 2019/06/28 13:35:04 deraadt Exp $ */
2/* 2/*
3 * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. 3 * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
4 * 4 *
@@ -122,7 +122,7 @@ fdlim_get(int hard)
122#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE) 122#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE)
123 struct rlimit rlfd; 123 struct rlimit rlfd;
124 124
125 if (getrlimit(RLIMIT_NOFILE, &rlfd) < 0) 125 if (getrlimit(RLIMIT_NOFILE, &rlfd) == -1)
126 return (-1); 126 return (-1);
127 if ((hard ? rlfd.rlim_max : rlfd.rlim_cur) == RLIM_INFINITY) 127 if ((hard ? rlfd.rlim_max : rlfd.rlim_cur) == RLIM_INFINITY)
128 return SSH_SYSFDMAX; 128 return SSH_SYSFDMAX;
@@ -143,10 +143,10 @@ fdlim_set(int lim)
143 if (lim <= 0) 143 if (lim <= 0)
144 return (-1); 144 return (-1);
145#if defined(HAVE_SETRLIMIT) && defined(RLIMIT_NOFILE) 145#if defined(HAVE_SETRLIMIT) && defined(RLIMIT_NOFILE)
146 if (getrlimit(RLIMIT_NOFILE, &rlfd) < 0) 146 if (getrlimit(RLIMIT_NOFILE, &rlfd) == -1)
147 return (-1); 147 return (-1);
148 rlfd.rlim_cur = lim; 148 rlfd.rlim_cur = lim;
149 if (setrlimit(RLIMIT_NOFILE, &rlfd) < 0) 149 if (setrlimit(RLIMIT_NOFILE, &rlfd) == -1)
150 return (-1); 150 return (-1);
151#elif defined (HAVE_SETDTABLESIZE) 151#elif defined (HAVE_SETDTABLESIZE)
152 setdtablesize(lim); 152 setdtablesize(lim);
@@ -343,13 +343,13 @@ tcpconnect(char *host)
343 } 343 }
344 for (ai = aitop; ai; ai = ai->ai_next) { 344 for (ai = aitop; ai; ai = ai->ai_next) {
345 s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); 345 s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
346 if (s < 0) { 346 if (s == -1) {
347 error("socket: %s", strerror(errno)); 347 error("socket: %s", strerror(errno));
348 continue; 348 continue;
349 } 349 }
350 if (set_nonblock(s) == -1) 350 if (set_nonblock(s) == -1)
351 fatal("%s: set_nonblock(%d)", __func__, s); 351 fatal("%s: set_nonblock(%d)", __func__, s);
352 if (connect(s, ai->ai_addr, ai->ai_addrlen) < 0 && 352 if (connect(s, ai->ai_addr, ai->ai_addrlen) == -1 &&
353 errno != EINPROGRESS) 353 errno != EINPROGRESS)
354 error("connect (`%s'): %s", host, strerror(errno)); 354 error("connect (`%s'): %s", host, strerror(errno));
355 else 355 else