]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Allow use of socketpair, WSASocketA
authorHugo Landau <hlandau@openssl.org>
Mon, 29 Apr 2024 09:24:30 +0000 (10:24 +0100)
committerNeil Horman <nhorman@openssl.org>
Mon, 17 Feb 2025 16:27:32 +0000 (11:27 -0500)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24971)

ssl/rio/rio_notifier.c
util/platform_symbols/unix-symbols.txt
util/platform_symbols/windows-symbols.txt

index 300b2135d32336352785a8fb80c7959c3affa7ea..b31cd433d6c871178b85d60ac0d0bc74bebd2db6 100644 (file)
@@ -30,13 +30,13 @@ static int create_socket(int domain, int socktype, int protocol)
      * non-inheritable, avoiding race conditions if another thread is about to
      * call CreateProcess.
      */
-    fd = WSASocketA(domain, socktype, protocol, NULL, 0,
-                    WSA_FLAG_NO_HANDLE_INHERIT);
+    fd = (int)WSASocketA(domain, socktype, protocol, NULL, 0,
+                         WSA_FLAG_NO_HANDLE_INHERIT);
     if (fd < 0)
         return -1;
 
     /* Prevent interference with the socket from other processes on Windows. */
-    if (setsockopt(lfd, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, &on, sizeof(on)) < 0) {
+    if (setsockopt(fd, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (void *)&on, sizeof(on)) < 0) {
         BIO_closesocket(fd);
         return -1;
     }
@@ -214,14 +214,14 @@ void ossl_rio_notifier_cleanup(RIO_NOTIFIER *nfy)
 int ossl_rio_notifier_signal(RIO_NOTIFIER *nfy)
 {
     static const unsigned char ch = 0;
-    ssize_t wr;
+    ossl_ssize_t wr;
 
     do
         /*
          * Note: If wr returns 0 the buffer is already full so we don't need to
          * do anything.
          */
-        wr = writesocket(nfy->wfd, &ch, sizeof(ch));
+        wr = writesocket(nfy->wfd, (void *)&ch, sizeof(ch));
     while (wr < 0 && get_last_socket_error_is_eintr());
 
     return 1;
@@ -230,14 +230,14 @@ int ossl_rio_notifier_signal(RIO_NOTIFIER *nfy)
 int ossl_rio_notifier_unsignal(RIO_NOTIFIER *nfy)
 {
     unsigned char buf[16];
-    ssize_t rd;
+    ossl_ssize_t rd;
 
     /*
      * signal() might have been called multiple times. Drain the buffer until
      * it's empty.
      */
     do
-        rd = readsocket(nfy->rfd, buf, sizeof(buf));
+        rd = readsocket(nfy->rfd, (void *)buf, sizeof(buf));
     while (rd == sizeof(buf)
            || (rd < 0 && get_last_socket_error_is_eintr()));
 
index 4b3d0f00c24f84293ba83809dbe23e0bd570df43..0820d4f264e70495c3b2fea87fb9099751093fb8 100644 (file)
@@ -131,6 +131,7 @@ shutdown
 sigaction
 sleep
 socket
+socketpair
 sprintf
 stderr
 stdin
index d838023f6f89bb7c899adb42596e01284be0d0a3..d0e6675a794ba7158dfaa93746a5aa89ff27d49c 100644 (file)
@@ -179,6 +179,7 @@ TryEnterCriticalSection
 DeleteCriticalSection
 ReleaseSemaphore
 WaitForSingleObject
+WSASocketA
 GetCurrentThreadId
 SetUnhandledExceptionFilter
 GetExitCodeThread