Skip to content

Commit

Permalink
io UPDATE infinite poll timeout fix in libssh
Browse files Browse the repository at this point in the history
Fixes #496
  • Loading branch information
michalvasko committed Aug 14, 2024
1 parent 1949624 commit 976d11a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <assert.h>
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
#include <pwd.h>
#include <stdarg.h>
#include <stdint.h>
Expand Down Expand Up @@ -398,6 +399,11 @@ nc_read_poll(struct nc_session *session, int io_timeout)
switch (session->ti_type) {
#ifdef NC_ENABLED_SSH_TLS
case NC_TI_SSH:
if (io_timeout == -1) {
/* BUG libssh 0.11.0 replaces timeout -1 with 0 for non-blocking sessions */
io_timeout = INT_MAX;
}

/* EINTR is handled, it resumes waiting */
ret = ssh_channel_poll_timeout(session->ti.libssh.channel, io_timeout, 0);
if (ret == SSH_ERROR) {
Expand Down

0 comments on commit 976d11a

Please sign in to comment.