From a779507b8418790d5f4833d72dda55a216f82e3a Mon Sep 17 00:00:00 2001 From: James Muehlner Date: Fri, 17 May 2024 17:18:42 +0000 Subject: [PATCH] GUACAMOLE-1841: Fixes for telnet on windows. --- src/protocols/telnet/telnet.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/protocols/telnet/telnet.c b/src/protocols/telnet/telnet.c index 9c0a8c163..9a7673078 100644 --- a/src/protocols/telnet/telnet.c +++ b/src/protocols/telnet/telnet.c @@ -84,7 +84,11 @@ static int __guac_telnet_write_all(int fd, const char* buffer, int size) { while (remaining > 0) { /* Attempt to write data */ +#ifdef WINDOWS_BUILD + int ret_val = send(fd, buffer, remaining, 0); +#else int ret_val = write(fd, buffer, remaining); +#endif if (ret_val <= 0) return -1; @@ -708,8 +712,11 @@ void* guac_telnet_client_thread(void* data) { /* Resume waiting of no data available */ if (wait_result == 0) continue; - +#ifdef WINDOWS_BUILD + int bytes_read = recv(telnet_client->socket_fd, buffer, sizeof(buffer), 0); +#else int bytes_read = read(telnet_client->socket_fd, buffer, sizeof(buffer)); +#endif if (bytes_read <= 0) break;