From 4c74f09393a72bfe9810d9708869cc2d5a6c0986 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Tue, 22 Aug 2023 14:34:37 -0700 Subject: [PATCH] Fix socket() EPROTONOSUPPORT fallback on MacOS --- libc/sock/socket-sysv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libc/sock/socket-sysv.c b/libc/sock/socket-sysv.c index 899a408ed..c972aae0f 100644 --- a/libc/sock/socket-sysv.c +++ b/libc/sock/socket-sysv.c @@ -25,7 +25,8 @@ int sys_socket(int family, int type, int protocol) { int sock, tf, e = errno; tf = SOCK_CLOEXEC | SOCK_NONBLOCK; sock = __sys_socket(family, type, protocol); - if (sock == -1 && (type & tf) && (errno == EINVAL || errno == EPROTOTYPE)) { + if (sock == -1 && (type & tf) && + (errno == EINVAL || errno == EPROTOTYPE || errno == EPROTONOSUPPORT)) { errno = e; // XNU/RHEL5/etc. don't support flags; see if removing helps sock = __fixupnewsockfd(__sys_socket(family, type & ~tf, protocol), type); }