mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
sftpserver: Fix loop termination
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -378,10 +378,11 @@ static void handle_session(ssh_event event, ssh_session session)
|
|||||||
do {
|
do {
|
||||||
/* Poll the main event which takes care of the session, the channel and
|
/* Poll the main event which takes care of the session, the channel and
|
||||||
* even our child process's stdout/stderr (once it's started). */
|
* even our child process's stdout/stderr (once it's started). */
|
||||||
if (ssh_event_dopoll(event, -1) == SSH_ERROR) {
|
if (ssh_event_dopoll(event, 100) == SSH_ERROR) {
|
||||||
ssh_channel_close(sdata.channel);
|
ssh_channel_close(sdata.channel);
|
||||||
}
|
}
|
||||||
} while (ssh_channel_is_open(sdata.channel));
|
} while (ssh_channel_is_open(sdata.channel) &&
|
||||||
|
!ssh_channel_is_eof(sdata.channel));
|
||||||
|
|
||||||
ssh_channel_send_eof(sdata.channel);
|
ssh_channel_send_eof(sdata.channel);
|
||||||
ssh_channel_close(sdata.channel);
|
ssh_channel_close(sdata.channel);
|
||||||
|
|||||||
@@ -358,10 +358,11 @@ void sftp_handle_session_cb(ssh_event event,
|
|||||||
do {
|
do {
|
||||||
/* Poll the main event which takes care of the session, the channel and
|
/* Poll the main event which takes care of the session, the channel and
|
||||||
* even our child process's stdout/stderr (once it's started). */
|
* even our child process's stdout/stderr (once it's started). */
|
||||||
if (ssh_event_dopoll(event, -1) == SSH_ERROR) {
|
if (ssh_event_dopoll(event, 100) == SSH_ERROR) {
|
||||||
ssh_channel_close(sdata.channel);
|
ssh_channel_close(sdata.channel);
|
||||||
}
|
}
|
||||||
} while (ssh_channel_is_open(sdata.channel));
|
} while (ssh_channel_is_open(sdata.channel) &&
|
||||||
|
!ssh_channel_is_eof(sdata.channel));
|
||||||
|
|
||||||
ssh_channel_send_eof(sdata.channel);
|
ssh_channel_send_eof(sdata.channel);
|
||||||
ssh_channel_close(sdata.channel);
|
ssh_channel_close(sdata.channel);
|
||||||
|
|||||||
Reference in New Issue
Block a user