Adapt for Linux with SOCK_CLOEXEC, patch from Harald Barth
This commit is contained in:
@@ -317,6 +317,7 @@ socket_to_fd(rk_socket_t sock, int flags)
|
||||
}
|
||||
|
||||
#ifndef HEIMDAL_SMALLER
|
||||
#undef socket
|
||||
|
||||
int rk_socket(int, int, int);
|
||||
|
||||
@@ -326,8 +327,8 @@ rk_socket(int domain, int type, int protocol)
|
||||
int s;
|
||||
s = socket (domain, type, protocol);
|
||||
#ifdef SOCK_CLOEXEC
|
||||
if ((SOCK_CLOEXEC & protocol) && s < 0 && errno == EINVAL) {
|
||||
protocol &= ~SOCK_CLOEXEC;
|
||||
if ((SOCK_CLOEXEC & type) && s < 0 && errno == EINVAL) {
|
||||
type &= ~SOCK_CLOEXEC;
|
||||
s = socket (domain, type, protocol);
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user