diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2013-07-14 14:50:24 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2013-07-14 15:02:08 +0200 |
commit | 483ba8100ff22f4d83107af611b21854b2bdabc2 (patch) | |
tree | f3fade9dda238e8330072e50c18fe2b23ce48c52 /examples | |
parent | 0138c9fd59a3fdf63791db6dd65aa2ff2abcb176 (diff) | |
download | libssh-483ba8100ff22f4d83107af611b21854b2bdabc2.tar.gz libssh-483ba8100ff22f4d83107af611b21854b2bdabc2.tar.xz libssh-483ba8100ff22f4d83107af611b21854b2bdabc2.zip |
examples: Check return value of ssh_event_dopoll().
CID #0
Diffstat (limited to 'examples')
-rw-r--r-- | examples/samplesshd-tty.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/examples/samplesshd-tty.c b/examples/samplesshd-tty.c index a0e79e43..a19071d4 100644 --- a/examples/samplesshd-tty.c +++ b/examples/samplesshd-tty.c @@ -286,7 +286,7 @@ static int main_loop(ssh_channel chan) { pid_t childpid; ssh_event event; short events; - + int rc; childpid = forkpty(&fd, NULL, term, win); if(childpid == 0) { @@ -318,7 +318,12 @@ static int main_loop(ssh_channel chan) { } do { - ssh_event_dopoll(event, 1000); + rc = ssh_event_dopoll(event, 1000); + if (rc == SSH_ERROR){ + fprintf(stderr, "Error : %s\n", ssh_get_error(session)); + ssh_disconnect(session); + return -1; + } } while(!ssh_channel_is_closed(chan)); ssh_event_remove_fd(event, fd); |