Skip to content

Commit a45ea31

Browse files
author
Sebastiano Merlino
committed
Fixed problem on OS/X
Fixed problem on OS/X; SOCK_CLOEXEC raises EPROTONOSUPPORT instead of EINVAL.
1 parent 8585d0e commit a45ea31

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/webserver.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,9 @@ int create_socket (int domain, int type, int protocol)
376376
/* use SOCK_STREAM rather than ai_socktype: some getaddrinfo
377377
* implementations do not set ai_socktype, e.g. RHL6.2. */
378378
fd = socket(domain, ctype, protocol);
379-
if ( (-1 == fd) && (EINVAL == errno) && (0 != sock_cloexec) )
379+
if ((fd == -1) &&
380+
(errno == EINVAL || errno == EPROTONOSUPPORT) && (sock_cloexec != 0)
381+
)
380382
{
381383
sock_cloexec = 0;
382384
fd = socket(domain, type, protocol);

0 commit comments

Comments
 (0)