Skip to content

Commit

Permalink
libdispatch: added patch to mostly work around possible crash when us…
Browse files Browse the repository at this point in the history
…ing NSURLSession

More info:
swiftlang/swift-corelibs-libdispatch#772
  • Loading branch information
triplef committed Feb 22, 2023
1 parent cea2676 commit 9e23112
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions patches/libdispatch-fix-socket-closed.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
https://github.com/apple/swift-corelibs-libdispatch/pull/772
---
diff --git a/src/event/event_windows.c b/src/event/event_windows.c
index 94674a3..148c9de 100644
--- a/src/event/event_windows.c
+++ b/src/event/event_windows.c
@@ -219,7 +219,11 @@ _dispatch_muxnote_disarm_events(dispatch_muxnote_t dmn,
iResult = WSAEventSelect((SOCKET)dmn->dmn_ident, NULL, 0);
}
if (iResult != 0) {
- DISPATCH_INTERNAL_CRASH(WSAGetLastError(), "WSAEventSelect");
+ // ignore error if socket was already closed
+ int err = WSAGetLastError();
+ if (err != WSAENOTSOCK) {
+ DISPATCH_INTERNAL_CRASH(err, "WSAEventSelect");
+ }
}
dmn->dmn_network_events = lNetworkEvents;
if (!lNetworkEvents && dmn->dmn_threadpool_wait) {

0 comments on commit 9e23112

Please sign in to comment.