1 $NetBSD: patch-ac,v 1.1 2005/08/04 10:22:21 drochner Exp $
3 Except for the first two chunks:
4 https://sourceforge.net/tracker/index.php?func=detail&aid=1252703&group_id=17338&atid=117338
6 --- tsocks.c.orig 2002-07-16 00:50:52.000000000 +0200
8 @@ -68,7 +68,7 @@ static int suid = 0;
9 static char *conffile = NULL;
11 /* Exported Function Prototypes */
13 +void __tsocks_init(void) __attribute__ ((__constructor__));
14 int connect(CONNECT_SIGNATURE);
15 int select(SELECT_SIGNATURE);
16 int poll(POLL_SIGNATURE);
17 @@ -100,7 +100,7 @@ static int read_socksv4_req(struct connr
18 static int read_socksv5_connect(struct connreq *conn);
19 static int read_socksv5_auth(struct connreq *conn);
22 +void __tsocks_init(void) {
26 @@ -658,7 +658,7 @@ int poll(POLL_SIGNATURE) {
27 * come around again (since we can't flag it for read, we don't know
28 * if there is any data to be read and can't be bothered checking) */
29 if (conn->selectevents & WRITE) {
30 - setevents |= POLLOUT;
31 + ufds[i].revents |= (conn->selectevents & WRITE);
35 @@ -852,7 +852,12 @@ static int connect_server(struct connreq
36 sizeof(conn->serveraddr));
38 show_msg(MSGDEBUG, "Connect returned %d, errno is %d\n", rc, errno);
40 + if (rc && errno == EISCONN) {
42 + show_msg(MSGDEBUG, "Socket %d already connected to SOCKET server\n",
44 + conn->state = CONNECTED;
46 if (errno != EINPROGRESS) {
47 show_msg(MSGERR, "Error %d attempting to connect to SOCKS "
48 "server (%s)\n", errno, strerror(errno));