1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-07-29 13:01:13 +03:00

Fix error reporting in connect_host()

This commit fixes connect_host() such that if
ssh_new() fails, connect_host() fails and provides
the reason for failure. Prior to this commit if
ssh_new() failed, connect_host() failed but did
not provide the reason for failure to connect to
the host.

Signed-off-by: Eshan Kelkar <eshankelkar@galorithm.com>
Reviewed-by: Sahana Prasad <sahana@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Eshan Kelkar
2023-06-14 00:20:11 +05:30
committed by Sahana Prasad
parent 4e239484fe
commit 08a8bd936c

View File

@ -282,8 +282,11 @@ static ssh_session connect_host(const char *host, int verbose, char *cipher)
int rc;
session = ssh_new();
if (session == NULL)
goto error;
if (session == NULL) {
fprintf(stderr, "Error connecting to \"%s\": %s\n",
host, "Unable to create a new ssh session");
return NULL;
}
rc = ssh_options_set(session, SSH_OPTIONS_HOST, host);
if (rc < 0)