summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Horman <nhorman@openssl.org>2024-04-06 18:28:57 -0400
committerNeil Horman <nhorman@openssl.org>2024-04-12 08:02:20 -0400
commit4ad6e549fadde344cbbe9d7f4aafb4d3a2a67094 (patch)
tree8c0051a5bd4ac69a5440205b68fe0648fd4bb310
parent3b56cd4f041cc78035aafd0f9afe50dd4a6dc1ed (diff)
dont include unistd.h on windows for sslecho
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)
-rw-r--r--demos/sslecho/main.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/demos/sslecho/main.c b/demos/sslecho/main.c
index c75eac2bc3..4973902cf5 100644
--- a/demos/sslecho/main.c
+++ b/demos/sslecho/main.c
@@ -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__,