From 483ba8100ff22f4d83107af611b21854b2bdabc2 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sun, 14 Jul 2013 14:50:24 +0200 Subject: [PATCH] examples: Check return value of ssh_event_dopoll(). CID #0 --- examples/samplesshd-tty.c | 9 +++++++-- 1 file 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);