summaryrefslogtreecommitdiff
path: root/clientloop.c
diff options
context:
space:
mode:
Diffstat (limited to 'clientloop.c')
-rw-r--r--clientloop.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/clientloop.c b/clientloop.c
index 086c0dfe8..b5a1f7038 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.322 2019/03/29 11:31:40 djm Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.327 2019/07/24 08:57:00 mestre Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -129,7 +129,7 @@ extern int muxserver_sock; /* XXX use mux_client_cleanup() instead */
129 129
130/* 130/*
131 * Name of the host we are connecting to. This is the name given on the 131 * Name of the host we are connecting to. This is the name given on the
132 * command line, or the HostName specified for the user-supplied name in a 132 * command line, or the Hostname specified for the user-supplied name in a
133 * configuration file. 133 * configuration file.
134 */ 134 */
135extern char *host; 135extern char *host;
@@ -338,7 +338,6 @@ client_x11_get_proto(struct ssh *ssh, const char *display,
338 "%s/xauthfile", xauthdir)) < 0 || 338 "%s/xauthfile", xauthdir)) < 0 ||
339 (size_t)r >= sizeof(xauthfile)) { 339 (size_t)r >= sizeof(xauthfile)) {
340 error("%s: xauthfile path too long", __func__); 340 error("%s: xauthfile path too long", __func__);
341 unlink(xauthfile);
342 rmdir(xauthdir); 341 rmdir(xauthdir);
343 return -1; 342 return -1;
344 } 343 }
@@ -562,7 +561,7 @@ client_wait_until_can_do_something(struct ssh *ssh,
562 } 561 }
563 562
564 ret = select((*maxfdp)+1, *readsetp, *writesetp, NULL, tvp); 563 ret = select((*maxfdp)+1, *readsetp, *writesetp, NULL, tvp);
565 if (ret < 0) { 564 if (ret == -1) {
566 /* 565 /*
567 * We have to clear the select masks, because we return. 566 * We have to clear the select masks, because we return.
568 * We have to return, because the mainloop checks for the flags 567 * We have to return, because the mainloop checks for the flags
@@ -645,11 +644,11 @@ client_process_net_input(struct ssh *ssh, fd_set *readset)
645 * There is a kernel bug on Solaris that causes select to 644 * There is a kernel bug on Solaris that causes select to
646 * sometimes wake up even though there is no data available. 645 * sometimes wake up even though there is no data available.
647 */ 646 */
648 if (len < 0 && 647 if (len == -1 &&
649 (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK)) 648 (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK))
650 len = 0; 649 len = 0;
651 650
652 if (len < 0) { 651 if (len == -1) {
653 /* 652 /*
654 * An error has encountered. Perhaps there is a 653 * An error has encountered. Perhaps there is a
655 * network problem. 654 * network problem.
@@ -1097,7 +1096,7 @@ process_escapes(struct ssh *ssh, Channel *c,
1097 1096
1098 /* Fork into background. */ 1097 /* Fork into background. */
1099 pid = fork(); 1098 pid = fork();
1100 if (pid < 0) { 1099 if (pid == -1) {
1101 error("fork: %.100s", strerror(errno)); 1100 error("fork: %.100s", strerror(errno));
1102 continue; 1101 continue;
1103 } 1102 }
@@ -1252,7 +1251,7 @@ client_loop(struct ssh *ssh, int have_pty, int escape_char_arg,
1252 if (options.control_master && 1251 if (options.control_master &&
1253 !option_clear_or_none(options.control_path)) { 1252 !option_clear_or_none(options.control_path)) {
1254 debug("pledge: id"); 1253 debug("pledge: id");
1255 if (pledge("stdio rpath wpath cpath unix inet dns recvfd proc exec id tty", 1254 if (pledge("stdio rpath wpath cpath unix inet dns recvfd sendfd proc exec id tty",
1256 NULL) == -1) 1255 NULL) == -1)
1257 fatal("%s pledge(): %s", __func__, strerror(errno)); 1256 fatal("%s pledge(): %s", __func__, strerror(errno));
1258 1257
@@ -1881,7 +1880,7 @@ static void
1881update_known_hosts(struct hostkeys_update_ctx *ctx) 1880update_known_hosts(struct hostkeys_update_ctx *ctx)
1882{ 1881{
1883 int r, was_raw = 0; 1882 int r, was_raw = 0;
1884 int loglevel = options.update_hostkeys == SSH_UPDATE_HOSTKEYS_ASK ? 1883 LogLevel loglevel = options.update_hostkeys == SSH_UPDATE_HOSTKEYS_ASK ?
1885 SYSLOG_LEVEL_INFO : SYSLOG_LEVEL_VERBOSE; 1884 SYSLOG_LEVEL_INFO : SYSLOG_LEVEL_VERBOSE;
1886 char *fp, *response; 1885 char *fp, *response;
1887 size_t i; 1886 size_t i;
@@ -2249,7 +2248,7 @@ client_session2_setup(struct ssh *ssh, int id, int want_tty, int want_subsystem,
2249 struct winsize ws; 2248 struct winsize ws;
2250 2249
2251 /* Store window size in the packet. */ 2250 /* Store window size in the packet. */
2252 if (ioctl(in_fd, TIOCGWINSZ, &ws) < 0) 2251 if (ioctl(in_fd, TIOCGWINSZ, &ws) == -1)
2253 memset(&ws, 0, sizeof(ws)); 2252 memset(&ws, 0, sizeof(ws));
2254 2253
2255 channel_request_start(ssh, id, "pty-req", 1); 2254 channel_request_start(ssh, id, "pty-req", 1);