From: Hugo Landau Date: Mon, 29 Apr 2024 09:24:30 +0000 (+0100) Subject: Allow use of socketpair, WSASocketA X-Git-Tag: openssl-3.5.0-alpha1~367 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=269409c75bd7bb3f02333ff3e6d227311750df40;p=thirdparty%2Fopenssl.git Allow use of socketpair, WSASocketA Reviewed-by: Matt Caswell Reviewed-by: Neil Horman (Merged from https://github.com/openssl/openssl/pull/24971) --- diff --git a/ssl/rio/rio_notifier.c b/ssl/rio/rio_notifier.c index 300b2135d32..b31cd433d6c 100644 --- a/ssl/rio/rio_notifier.c +++ b/ssl/rio/rio_notifier.c @@ -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())); diff --git a/util/platform_symbols/unix-symbols.txt b/util/platform_symbols/unix-symbols.txt index 4b3d0f00c24..0820d4f264e 100644 --- a/util/platform_symbols/unix-symbols.txt +++ b/util/platform_symbols/unix-symbols.txt @@ -131,6 +131,7 @@ shutdown sigaction sleep socket +socketpair sprintf stderr stdin diff --git a/util/platform_symbols/windows-symbols.txt b/util/platform_symbols/windows-symbols.txt index d838023f6f8..d0e6675a794 100644 --- a/util/platform_symbols/windows-symbols.txt +++ b/util/platform_symbols/windows-symbols.txt @@ -179,6 +179,7 @@ TryEnterCriticalSection DeleteCriticalSection ReleaseSemaphore WaitForSingleObject +WSASocketA GetCurrentThreadId SetUnhandledExceptionFilter GetExitCodeThread