On HP-UX, connect(), bind() etc. do not use the struct sockaddr type but
use a void pointer instead. Check for that at configure time.
This commit is contained in:
parent
7e045d886e
commit
647967d366
12
configure.ac
12
configure.ac
@ -59,6 +59,18 @@ AC_CHECK_TYPES(socklen_t, [], [],
|
||||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>])
|
||||
|
||||
AC_MSG_CHECKING(for connect() second argument)
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/socket.h>],
|
||||
[#if defined HAVE_SOCKLEN_T
|
||||
int connect(int, const struct sockaddr *, socklen_t);
|
||||
#else
|
||||
int connect(int, const struct sockaddr *, int);
|
||||
#endif],
|
||||
[AC_MSG_RESULT(const struct sockaddr *)
|
||||
AC_DEFINE(CONNECT_USES_STRUCT_SOCKADDR, 1, [Define to 1 if connect() uses struct sockaddr.])],
|
||||
[AC_MSG_RESULT(const void *)])
|
||||
|
||||
AC_MSG_CHECKING(for read() prototype)
|
||||
AC_TRY_COMPILE([#define _INCLUDE_POSIX_SOURCE
|
||||
#include <unistd.h>],
|
||||
|
||||
@ -76,6 +76,12 @@
|
||||
# define SOCKLEN_T int
|
||||
#endif
|
||||
|
||||
#if defined CONNECT_USES_STRUCT_SOCKADDR
|
||||
# define SOCKADDR_T struct sockaddr
|
||||
#else
|
||||
# define SOCKADDR_T void
|
||||
#endif
|
||||
|
||||
/* Local prototypes */
|
||||
#if defined HAVE_READV || defined HAVE_RECVMSG
|
||||
static void fuzz_iovec (int fd, const struct iovec *iov, ssize_t ret);
|
||||
@ -97,15 +103,15 @@ static int (*ORIG(dup)) (int oldfd);
|
||||
static int (*ORIG(dup2)) (int oldfd, int newfd);
|
||||
#endif
|
||||
#if defined HAVE_ACCEPT
|
||||
static int (*ORIG(accept)) (int sockfd, struct sockaddr *addr,
|
||||
static int (*ORIG(accept)) (int sockfd, SOCKADDR_T *addr,
|
||||
SOCKLEN_T *addrlen);
|
||||
#endif
|
||||
#if defined HAVE_BIND
|
||||
static int (*ORIG(bind)) (int sockfd, const struct sockaddr *my_addr,
|
||||
static int (*ORIG(bind)) (int sockfd, const SOCKADDR_T *my_addr,
|
||||
SOCKLEN_T addrlen);
|
||||
#endif
|
||||
#if defined HAVE_CONNECT
|
||||
static int (*ORIG(connect)) (int sockfd, const struct sockaddr *serv_addr,
|
||||
static int (*ORIG(connect)) (int sockfd, const SOCKADDR_T *serv_addr,
|
||||
SOCKLEN_T addrlen);
|
||||
#endif
|
||||
#if defined HAVE_SOCKET
|
||||
@ -116,7 +122,7 @@ static RECV_T (*ORIG(recv)) (int s, void *buf, size_t len, int flags);
|
||||
#endif
|
||||
#if defined HAVE_RECVFROM
|
||||
static RECV_T (*ORIG(recvfrom))(int s, void *buf, size_t len, int flags,
|
||||
struct sockaddr *from, SOCKLEN_T *fromlen);
|
||||
SOCKADDR_T *from, SOCKLEN_T *fromlen);
|
||||
#endif
|
||||
#if defined HAVE_RECVMSG
|
||||
static RECV_T (*ORIG(recvmsg)) (int s, struct msghdr *hdr, int flags);
|
||||
@ -244,7 +250,7 @@ int NEW(dup2)(int oldfd, int newfd)
|
||||
#endif
|
||||
|
||||
#if defined HAVE_ACCEPT
|
||||
int NEW(accept)(int sockfd, struct sockaddr *addr, SOCKLEN_T *addrlen)
|
||||
int NEW(accept)(int sockfd, SOCKADDR_T *addr, SOCKLEN_T *addrlen)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -310,14 +316,14 @@ int NEW(accept)(int sockfd, struct sockaddr *addr, SOCKLEN_T *addrlen)
|
||||
} while(0);
|
||||
|
||||
#if defined HAVE_BIND
|
||||
int NEW(bind)(int sockfd, const struct sockaddr *my_addr, SOCKLEN_T addrlen)
|
||||
int NEW(bind)(int sockfd, const SOCKADDR_T *my_addr, SOCKLEN_T addrlen)
|
||||
{
|
||||
int ret; ZZ_CONNECT(bind, my_addr); return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined HAVE_CONNECT
|
||||
int NEW(connect)(int sockfd, const struct sockaddr *serv_addr,
|
||||
int NEW(connect)(int sockfd, const SOCKADDR_T *serv_addr,
|
||||
SOCKLEN_T addrlen)
|
||||
{
|
||||
int ret; ZZ_CONNECT(connect, serv_addr); return ret;
|
||||
@ -379,7 +385,7 @@ RECV_T NEW(recv)(int s, void *buf, size_t len, int flags)
|
||||
|
||||
#if defined HAVE_RECVFROM
|
||||
RECV_T NEW(recvfrom)(int s, void *buf, size_t len, int flags,
|
||||
struct sockaddr *from, SOCKLEN_T *fromlen)
|
||||
SOCKADDR_T *from, SOCKLEN_T *fromlen)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user