Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / net / tsocks / patches / patch-ac
blobad7eea0fa353355c7c9b34dc5070602aa617464d
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
7 +++ tsocks.c
8 @@ -68,7 +68,7 @@ static int suid = 0;
9  static char *conffile = NULL;
11  /* Exported Function Prototypes */
12 -void _init(void);
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);
21 -void _init(void) {
22 +void __tsocks_init(void) {
23  #ifdef USE_OLD_DLSYM
24         void *lib;
25  #endif
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);
32                 nevents++;
33              }
34           }
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); 
39 -       if (rc) {
40 +   if (rc && errno == EISCONN) {
41 +      rc = 0;
42 +      show_msg(MSGDEBUG, "Socket %d already connected to SOCKET server\n",
43 +               conn->sockid);
44 +      conn->state = CONNECTED;
45 +   } else if (rc) {
46        if (errno != EINPROGRESS) {
47           show_msg(MSGERR, "Error %d attempting to connect to SOCKS "
48                    "server (%s)\n", errno, strerror(errno));