aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-07-14 14:50:24 +0200
committerAndreas Schneider <asn@cryptomilk.org>2013-07-14 15:02:08 +0200
commit483ba8100ff22f4d83107af611b21854b2bdabc2 (patch)
treef3fade9dda238e8330072e50c18fe2b23ce48c52 /examples
parent0138c9fd59a3fdf63791db6dd65aa2ff2abcb176 (diff)
downloadlibssh-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.c9
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);