From 4072d834bab61e0e28765db63206291399f3bb4e Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi

Date: Sun, 6 Oct 2024 14:32:14 +0300

Subject: [PATCH 1/1] Socket: Potential thread safety issue

Lock while updating the file descriptor.


src/platform/posix/socket.c | 2 ++

1 file changed, 2 insertions(+)

diff --git a/src/platform/posix/socket.c b/src/platform/posix/socket.c

index 047ce16..2a0f9d2 100644

--- a/src/platform/posix/socket.c

+++ b/src/platform/posix/socket.c

@@ -365,6 +365,7 @@ static iThreadResult connectAsync_Socket_(iThread *thd) {

             /* Ran out of addresses. */

             break;

         }

         iDebug("[Socket] connecting async to %s (addrSize:%u index:%d)\n",

                cstrCollect_String(toString_SockAddr(addr)),

                addrSize, indexInFamily);

@@ -375,6 +376,7 @@ static iThreadResult connectAsync_Socket_(iThread *thd) {

         }

         iDebug("[Socket] family:%d type:%d protocol:%d\n", sp.family, sp.type, sp.protocol);

         d->fd = socket(sp.family, sp.type, sp.protocol);

         if (!setNonBlocking_Socket_(d, iTrue)) {

             /* Wait indefinitely. */

             rc = connect(d->fd, addr, addrSize);

--

2.25.1

Proxy Information
Original URL
gemini://git.skyjake.fi/the_Foundation/main/patch/4072d834bab61e0e28765db63206291399f3bb4e.patch
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
56.264853 milliseconds
Gemini-to-HTML Time
0.579868 milliseconds

This content has been proxied by September (ba2dc).