From eae3a60ef801c0a3245ba91a1bb60acccbdacc03 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Fri, 2 Aug 2024 10:41:29 +0200 Subject: [PATCH] Fix proxy_disconnect on systems without pthread Signed-off-by: Jakub Jelen Reviewed-by: Andreas Schneider (cherry picked from commit b804aa9286ce6d6d715b5615f983d4728f0e2091) --- src/client.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/client.c b/src/client.c index f4229d89..6dbce26f 100644 --- a/src/client.c +++ b/src/client.c @@ -47,6 +47,12 @@ #include "libssh/pki.h" #include "libssh/kex.h" +#ifndef _WIN32 +#ifdef HAVE_PTHREAD +extern int proxy_disconnect; +#endif /* HAVE_PTHREAD */ +#endif /* _WIN32 */ + #define set_status(session, status) do {\ if (session->common.callbacks && session->common.callbacks->connect_status_function) \ session->common.callbacks->connect_status_function(session->common.callbacks->userdata, status); \ @@ -765,8 +771,6 @@ ssh_session_set_disconnect_message(ssh_session session, const char *message) return SSH_OK; } -extern int proxy_disconnect; - /** * @brief Disconnect from a session (client or server). * @@ -789,12 +793,14 @@ ssh_disconnect(ssh_session session) } #ifndef _WIN32 +#ifdef HAVE_PTHREAD /* Only send the disconnect to all other threads when the root session calls * ssh_disconnect() */ if (session->proxy_root) { proxy_disconnect = 1; } -#endif +#endif /* HAVE_PTHREAD */ +#endif /* _WIN32 */ if (session->disconnect_message == NULL) { session->disconnect_message = strdup("Bye Bye") ;