1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-07-04 09:22:28 +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

@ -223,7 +223,7 @@ LIBSSH2_ALLOC_FUNC(test_alloc)
{
int *threshold_int_ptr = *abstract;
alloc_count++;
if(*abstract != NULL && *threshold_int_ptr == alloc_count) {
if(*abstract && *threshold_int_ptr == alloc_count) {
return NULL;
}
@ -252,7 +252,7 @@ int test_case(int num,
alloc_count = 0;
free_count = 0;
session = libssh2_session_init_ex(test_alloc, test_free, NULL, abstract);
if(session == NULL) {
if(!session) {
fprintf(stderr, "libssh2_session_init_ex failed\n");
return 1;
}