mirror of
https://github.com/clearml/dropbear
synced 2025-04-16 21:41:37 +00:00
Improve EOF handling for half-close. Patch from Catalin Patulea
Fixes the situation $ ./dbclient root@1.2.3.4 'cat; echo foo' ^D <no output>
This commit is contained in:
parent
e7917c16c9
commit
dffb33cecf
@ -307,7 +307,9 @@ static void check_close(struct Channel *channel) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel->recv_eof && !write_pending(channel)) {
|
if ((channel->recv_eof && !write_pending(channel))
|
||||||
|
/* have a server "session" and child has exited */
|
||||||
|
|| (channel->type->check_close && close_allowed)) {
|
||||||
close_chan_fd(channel, channel->writefd, SHUT_WR);
|
close_chan_fd(channel, channel->writefd, SHUT_WR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,6 +338,7 @@ static void check_close(struct Channel *channel) {
|
|||||||
|
|
||||||
/* And if we can't receive any more data from them either, close up */
|
/* And if we can't receive any more data from them either, close up */
|
||||||
if (channel->readfd == FD_CLOSED
|
if (channel->readfd == FD_CLOSED
|
||||||
|
&& channel->writefd == FD_CLOSED
|
||||||
&& (ERRFD_IS_WRITE(channel) || channel->errfd == FD_CLOSED)
|
&& (ERRFD_IS_WRITE(channel) || channel->errfd == FD_CLOSED)
|
||||||
&& !channel->sent_close
|
&& !channel->sent_close
|
||||||
&& close_allowed
|
&& close_allowed
|
||||||
|
Loading…
Reference in New Issue
Block a user