#define _GNU_SOURCE
#include <dlfcn.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/errno.h>

#define REAL_LIBC RTLD_NEXT

int connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len)
{
	int (*origconnect) (int, __CONST_SOCKADDR_ARG, socklen_t);
	int ret;
	
	origconnect = dlsym (REAL_LIBC, "connect");
	ret = origconnect(__fd, __addr, __len);
	if ( (ret == -1) && (errno == EINVAL) )
		ret = 0;
	return(ret);
}
