mirror of
https://github.com/upa/mscp.git
synced 2026-02-14 00:54:43 +08:00
cleanup error message handling
The top-level funtion in a thread should print errors using priv_get_err(), while lower-level functions should set error messages using priv_set_err() except that error mesesages should be printed immediately, e.g., under walk_src_path().
This commit is contained in:
@@ -186,6 +186,7 @@ static ssh_session ssh_init_session(const char *sshdst, struct mscp_ssh_opts *op
|
||||
}
|
||||
|
||||
if (!opts->no_hostkey_check && ssh_verify_known_hosts(ssh) != 0) {
|
||||
priv_set_errv("ssh_veriy_known_hosts failed");
|
||||
goto disconnect_out;
|
||||
}
|
||||
|
||||
@@ -203,9 +204,8 @@ sftp_session ssh_init_sftp_session(const char *sshdst, struct mscp_ssh_opts *opt
|
||||
sftp_session sftp;
|
||||
ssh_session ssh = ssh_init_session(sshdst, opts);
|
||||
|
||||
if (!ssh) {
|
||||
if (!ssh)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sftp = sftp_new(ssh);
|
||||
if (!sftp) {
|
||||
@@ -304,7 +304,7 @@ static int ssh_verify_known_hosts(ssh_session session)
|
||||
|
||||
break;
|
||||
case SSH_KNOWN_HOSTS_ERROR:
|
||||
priv_set_errv("known hosts error: %s", ssh_get_error(session));
|
||||
fprintf(stderr, "known hosts error: %s", ssh_get_error(session));
|
||||
ssh_clean_pubkey_hash(&hash);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user