Adapt for Linux with SOCK_CLOEXEC, patch from Harald Barth
This commit is contained in:
@@ -3,6 +3,12 @@
|
|||||||
BEGIN {
|
BEGIN {
|
||||||
print "#include <config.h>"
|
print "#include <config.h>"
|
||||||
print "#include <stdio.h>"
|
print "#include <stdio.h>"
|
||||||
|
print "#ifdef HAVE_SYS_TYPES_H"
|
||||||
|
print "#include <sys/types.h>"
|
||||||
|
print "#endif"
|
||||||
|
print "#ifdef HAVE_SYS_SOCKET_H"
|
||||||
|
print "#include <sys/socket.h>"
|
||||||
|
print "#endif"
|
||||||
print ""
|
print ""
|
||||||
print "int main(int argc, char **argv)"
|
print "int main(int argc, char **argv)"
|
||||||
print "{"
|
print "{"
|
||||||
|
@@ -1036,6 +1036,7 @@ rk_qsort(void *, size_t, size_t, int (*)(const void *, const void *));
|
|||||||
#if defined(__LINUX__) && SOCK_CLOEXEC && !defined(SOCKET_WRAPPER_REPLACE)
|
#if defined(__LINUX__) && SOCK_CLOEXEC && !defined(SOCKET_WRAPPER_REPLACE)
|
||||||
#undef socket
|
#undef socket
|
||||||
#define socket(_fam,_type,_prot) rk_socket(_fam,_type,_prot)
|
#define socket(_fam,_type,_prot) rk_socket(_fam,_type,_prot)
|
||||||
|
int ROKEN_LIB_FUNCTION rk_socket(int, int, int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SOCKET_WRAPPER_REPLACE
|
#ifdef SOCKET_WRAPPER_REPLACE
|
||||||
|
@@ -317,6 +317,7 @@ socket_to_fd(rk_socket_t sock, int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HEIMDAL_SMALLER
|
#ifndef HEIMDAL_SMALLER
|
||||||
|
#undef socket
|
||||||
|
|
||||||
int rk_socket(int, int, int);
|
int rk_socket(int, int, int);
|
||||||
|
|
||||||
@@ -326,8 +327,8 @@ rk_socket(int domain, int type, int protocol)
|
|||||||
int s;
|
int s;
|
||||||
s = socket (domain, type, protocol);
|
s = socket (domain, type, protocol);
|
||||||
#ifdef SOCK_CLOEXEC
|
#ifdef SOCK_CLOEXEC
|
||||||
if ((SOCK_CLOEXEC & protocol) && s < 0 && errno == EINVAL) {
|
if ((SOCK_CLOEXEC & type) && s < 0 && errno == EINVAL) {
|
||||||
protocol &= ~SOCK_CLOEXEC;
|
type &= ~SOCK_CLOEXEC;
|
||||||
s = socket (domain, type, protocol);
|
s = socket (domain, type, protocol);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -94,6 +94,7 @@ HEIMDAL_ROKEN_1.0 {
|
|||||||
rk_simple_execve_timed;
|
rk_simple_execve_timed;
|
||||||
rk_simple_execvp;
|
rk_simple_execvp;
|
||||||
rk_simple_execvp_timed;
|
rk_simple_execvp_timed;
|
||||||
|
rk_socket;
|
||||||
rk_socket_addr_size;
|
rk_socket_addr_size;
|
||||||
rk_socket_get_address;
|
rk_socket_get_address;
|
||||||
rk_socket_get_port;
|
rk_socket_get_port;
|
||||||
|
Reference in New Issue
Block a user