aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-06-30 14:17:31 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-06-30 14:37:04 +0200
commita19513b87a7763a521a33771bac238118f9ec6e8 (patch)
treec9c7beb53c1c3167a753fa744f5e79e5e65cd636
parent21962dd154e6f5e02d29706db5ddd43722ffae5c (diff)
downloadlibssh-a19513b87a7763a521a33771bac238118f9ec6e8.tar.gz
libssh-a19513b87a7763a521a33771bac238118f9ec6e8.tar.xz
libssh-a19513b87a7763a521a33771bac238118f9ec6e8.zip
example: Add missing error checks in ssh_server_fork
CID 1393676 Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--examples/ssh_server_fork.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/examples/ssh_server_fork.c b/examples/ssh_server_fork.c
index 18320c84..217c5298 100644
--- a/examples/ssh_server_fork.c
+++ b/examples/ssh_server_fork.c
@@ -621,6 +621,7 @@ int main(int argc, char **argv) {
ssh_session session;
ssh_event event;
struct sigaction sa;
+ int rc;
/* Set up SIGCHLD handler. */
sa.sa_handler = sigchld_handler;
@@ -631,8 +632,17 @@ int main(int argc, char **argv) {
return 1;
}
- ssh_init();
+ rc = ssh_init();
+ if (rc < 0) {
+ fprintf(stderr, "ssh_init failed\n");
+ return 1;
+ }
+
sshbind = ssh_bind_new();
+ if (sshbind == NULL) {
+ fprintf(stderr, "ssh_bind_new failed\n");
+ return 1;
+ }
#ifdef HAVE_ARGP_H
argp_parse(&argp, argc, argv, 0, 0, sshbind);