diff options
| author | Ryo Nakamura <upa@haeena.net> | 2024-02-07 13:29:45 +0900 |
|---|---|---|
| committer | Ryo Nakamura <upa@haeena.net> | 2024-02-07 13:29:45 +0900 |
| commit | 96084004b699bd8b5abc1c37b3ef4af2e6a37e26 (patch) | |
| tree | e00193e4da4538f2ee49fd19779192e45d7f70a7 /src/ssh.c | |
| parent | 5119d5ae263be1c4e19d8bc749b7211327686945 (diff) | |
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().
Diffstat (limited to 'src/ssh.c')
| -rw-r--r-- | src/ssh.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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; } |
