mirror of
https://github.com/PowerShell/Win32-OpenSSH.git
synced 2025-07-25 15:04:54 +02:00
Fix regression issue of ssh not exiting after sftp client ends
Add smarter logic when reading 0 bytes is ok (only when tty console read )
This commit is contained in:
parent
3a660dc4c7
commit
df50964dfc
@ -91,6 +91,7 @@
|
|||||||
|
|
||||||
#ifdef WIN32_FIXME
|
#ifdef WIN32_FIXME
|
||||||
#define isatty(a) WSHELPisatty(a)
|
#define isatty(a) WSHELPisatty(a)
|
||||||
|
#define SFD_TYPE_CONSOLE 4
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -1686,8 +1687,10 @@ channel_handle_rfd(Channel *c, fd_set *readset, fd_set *writeset)
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
len = read(c->rfd, buf, sizeof(buf));
|
len = read(c->rfd, buf, sizeof(buf));
|
||||||
#ifdef WIN32_FIXME
|
#ifdef WIN32_FIXME
|
||||||
if (len == 0)
|
if (len == 0) {
|
||||||
|
if ( get_sfd_type(c->rfd) == SFD_TYPE_CONSOLE)
|
||||||
return 1; // in Win32 console read, there may be no data, but is ok
|
return 1; // in Win32 console read, there may be no data, but is ok
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (len < 0 && (errno == EINTR ||
|
if (len < 0 && (errno == EINTR ||
|
||||||
((errno == EAGAIN || errno == EWOULDBLOCK) && !force)))
|
((errno == EAGAIN || errno == EWOULDBLOCK) && !force)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user