Correctly handle EOF when reading from stdin (on window close)

This commit is contained in:
Brendan Shanks 2017-09-05 23:57:11 -07:00
parent 28dacfe5d5
commit d56cb8d5a6
1 changed files with 6 additions and 0 deletions

View File

@ -1604,6 +1604,12 @@ void *ssh2_thread(WindRec*w)
if (bytes > 0)
libssh2_channel_write(channel, buf, bytes);
else if (bytes == 0)
break; // EOF: window was closed. Close channel/session/connection.
else {
syslog(0, "read() from stdin returned -1 errno %d\n", errno);
break;
}
}
//if (FD_ISSET(stdoutfd, &writefds))
//{