support solaris X/Open connect call too

solaris curiously defines connect to point to __xnet_connect when
_XOPEN_SOURCE is defined 600.
that means some programs use the real connect symbol, while others
use __xnet_connect.

thanks to @Low-power for testing.

https://github.com/nxmirrors/onnv/blob/master/usr/src/lib/libsocket/socket/socket.c
https://github.com/nxmirrors/onnv/blob/master/usr/src/uts/common/sys/socket.h#L486
pull/224/head
rofl0r 2018-01-10 17:23:36 +00:00
parent 35a674bdbc
commit 1a62ec60af
1 changed files with 15 additions and 0 deletions

View File

@ -45,6 +45,12 @@
#define SOCKFAMILY(x) (satosin(x)->sin_family)
#define MAX_CHAIN 512
#ifdef IS_SOLARIS
#undef connect
int __xnet_connect(int sock, const struct sockaddr *addr, unsigned int len);
connect_t true___xnet_connect;
#endif
close_t true_close;
connect_t true_connect;
gethostbyname_t true_gethostbyname;
@ -108,6 +114,9 @@ static void setup_hooks(void) {
SETUP_SYM(gethostbyaddr);
SETUP_SYM(getnameinfo);
SETUP_SYM(close);
#ifdef IS_SOLARIS
SETUP_SYM(__xnet_connect);
#endif
}
static int close_fds[16];
@ -399,6 +408,12 @@ int connect(int sock, const struct sockaddr *addr, unsigned int len) {
return ret;
}
#ifdef IS_SOLARIS
int __xnet_connect(int sock, const struct sockaddr *addr, unsigned int len) {
return connect(sock, addr, len);
}
#endif
static struct gethostbyname_data ghbndata;
struct hostent *gethostbyname(const char *name) {
INIT();