aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2010-03-29 22:38:38 +0200
committerAndreas Schneider <mail@cynapses.org>2010-03-29 22:38:38 +0200
commita47a9ecad1fafa3784db8a67a9c9a3056024a331 (patch)
treeaf1420b46bb7031c13dd2bb4866b9996999ff92f /examples
parentd07aef725e05f02e34d89bce8543a975052f4a6d (diff)
downloadlibssh-a47a9ecad1fafa3784db8a67a9c9a3056024a331.tar.gz
libssh-a47a9ecad1fafa3784db8a67a9c9a3056024a331.tar.xz
libssh-a47a9ecad1fafa3784db8a67a9c9a3056024a331.zip
Fixed build warnings in the knownhosts example.
Diffstat (limited to 'examples')
-rw-r--r--examples/knownhosts.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/examples/knownhosts.c b/examples/knownhosts.c
index d57ad45..f4160dd 100644
--- a/examples/knownhosts.c
+++ b/examples/knownhosts.c
@@ -63,12 +63,16 @@ int verify_knownhost(ssh_session session){
fprintf(stderr,"The server is unknown. Do you trust the host key ?\n");
fprintf(stderr, "Public key hash: %s\n", hexa);
free(hexa);
- fgets(buf,sizeof(buf),stdin);
+ if (fgets(buf, sizeof(buf), stdin) == NULL) {
+ return -1;
+ }
if(strncasecmp(buf,"yes",3)!=0){
return -1;
}
fprintf(stderr,"This new key will be written on disk for further usage. do you agree ?\n");
- fgets(buf,sizeof(buf),stdin);
+ if (fgets(buf, sizeof(buf), stdin) == NULL) {
+ return -1;
+ }
if(strncasecmp(buf,"yes",3)==0){
if (ssh_write_knownhost(session) < 0) {
free(hash);