]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
dont include unistd.h on windows for sslecho
authorNeil Horman <nhorman@openssl.org>
Sat, 6 Apr 2024 22:28:57 +0000 (18:28 -0400)
committerNeil Horman <nhorman@openssl.org>
Fri, 12 Apr 2024 12:02:20 +0000 (08:02 -0400)
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/24047)

demos/sslecho/main.c

index c75eac2bc374c1051f651bd19729d7e43049af8e..4973902cf56d46223be3c20fbe6c3b58fb6e4bff 100644 (file)
@@ -8,14 +8,19 @@
  */
 
 #include <stdio.h>
-#include <unistd.h>
 #include <string.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
+#include <signal.h>
 #include <openssl/ssl.h>
 #include <openssl/err.h>
 #include <signal.h>
+#if !defined(OPENSSL_SYS_WINDOWS)
+#include <unistd.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#else
+#include <winsock.h>
+#endif
 
 static const int server_port = 4433;
 
@@ -153,8 +158,10 @@ int main(int argc, char **argv)
     struct sockaddr_in addr;
     unsigned int addr_len = sizeof(addr);
 
+#if !defined (OPENSSL_SYS_WINDOWS)
     /* ignore SIGPIPE so that server can continue running when client pipe closes abruptly */
     signal(SIGPIPE, SIG_IGN);
+#endif
 
     /* Splash */
     printf("\nsslecho : Simple Echo Client/Server : %s : %s\n\n", __DATE__,