ssh_sftp_do_select: don't fail if a callback is pending.

ssh_sftp_loop_iteration() used to return failure if no file handle was
in use for the select loop, on the basis that that means select would
just loop forever. But if there's a toplevel callback pending - in
particular, if it's going to do something like emptying ssh->in_raw
which will put an fd _back into_ the next iteration of the select loop
- then that's not a good enough reason to return permanent failure.
Just go round the loop, run the callback, and try again.
This commit is contained in:
Simon Tatham 2019-02-17 19:09:38 +00:00
Родитель 5bc6db4b96
Коммит 5dadbdf556
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -463,7 +463,7 @@ static int ssh_sftp_do_select(bool include_stdin, bool no_fds_ok)
for (fd = first_fd(&fdstate, &rwx); fd >= 0;
fd = next_fd(&fdstate, &rwx)) i++;
if (i < 1 && !no_fds_ok)
if (i < 1 && !no_fds_ok && !toplevel_callback_pending())
return -1; /* doom */
/* Expand the fdlist buffer if necessary. */