1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-07-29 13:01:14 +03:00

tidy-up: example, tests continued

- fix skip auth if `userauthlist` is NULL.
  Closes #836 (Reported-by: @sudipm-mukherjee on github)
- fix most silenced `checksrc` warnings.
- sync examples/tests code between each other.
  (output messages, error handling, declaration order, comments)
- stop including unnecessary headers.
- always deinitialize in case of error.
- drop some redundant variables.
- add error handling where missing.
- show more error codes.
- switch `perror()` to `fprintf()`.
- fix some `printf()`s to be `fprintf()`.
- formatting.

Closes #960
This commit is contained in:
Viktor Szakats
2023-04-14 11:05:21 +00:00
parent 0162d1649c
commit 2efdb6747a
51 changed files with 1550 additions and 1289 deletions

View File

@ -21,7 +21,7 @@ int test(LIBSSH2_SESSION *session)
char *expected_hostkey = NULL;
const char *hostkey = libssh2_session_hostkey(session, &len, &type);
if(hostkey == NULL) {
if(!hostkey) {
print_last_session_error("libssh2_session_hostkey");
return 1;
}
@ -41,7 +41,7 @@ int test(LIBSSH2_SESSION *session)
return 1;
}
if(rc != 0) {
if(rc) {
print_last_session_error("libssh2_base64_decode");
return 1;
}