mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
Fix socket() EPROTONOSUPPORT fallback on MacOS
This commit is contained in:
parent
58ef4e6df8
commit
4c74f09393
1 changed files with 2 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue