ce96bb8d74
This change lets, e.g. tnftp work when using tsocks. From soda@ in PR pkg/30921. Bump PKGREVISION to 2.
48 lines
1.7 KiB
Text
48 lines
1.7 KiB
Text
$NetBSD: patch-ac,v 1.2 2006/09/17 11:45:04 jmmv Exp $
|
|
|
|
Except for the first two chunks:
|
|
https://sourceforge.net/tracker/index.php?func=detail&aid=1252703&group_id=17338&atid=117338
|
|
|
|
--- tsocks.c.orig 2002-07-16 00:50:52.000000000 +0200
|
|
+++ tsocks.c
|
|
@@ -68,7 +68,7 @@ static int suid = 0;
|
|
static char *conffile = NULL;
|
|
|
|
/* Exported Function Prototypes */
|
|
-void _init(void);
|
|
+void __tsocks_init(void) __attribute__ ((__constructor__));
|
|
int connect(CONNECT_SIGNATURE);
|
|
int select(SELECT_SIGNATURE);
|
|
int poll(POLL_SIGNATURE);
|
|
@@ -100,7 +100,7 @@ static int read_socksv4_req(struct connr
|
|
static int read_socksv5_connect(struct connreq *conn);
|
|
static int read_socksv5_auth(struct connreq *conn);
|
|
|
|
-void _init(void) {
|
|
+void __tsocks_init(void) {
|
|
#ifdef USE_OLD_DLSYM
|
|
void *lib;
|
|
#endif
|
|
@@ -658,7 +658,7 @@ int poll(POLL_SIGNATURE) {
|
|
* come around again (since we can't flag it for read, we don't know
|
|
* if there is any data to be read and can't be bothered checking) */
|
|
if (conn->selectevents & WRITE) {
|
|
- setevents |= POLLOUT;
|
|
+ ufds[i].revents |= (conn->selectevents & WRITE);
|
|
nevents++;
|
|
}
|
|
}
|
|
@@ -852,7 +852,12 @@ static int connect_server(struct connreq
|
|
sizeof(conn->serveraddr));
|
|
|
|
show_msg(MSGDEBUG, "Connect returned %d, errno is %d\n", rc, errno);
|
|
- if (rc) {
|
|
+ if (rc && errno == EISCONN) {
|
|
+ rc = 0;
|
|
+ show_msg(MSGDEBUG, "Socket %d already connected to SOCKET server\n",
|
|
+ conn->sockid);
|
|
+ conn->state = CONNECTED;
|
|
+ } else if (rc) {
|
|
if (errno != EINPROGRESS) {
|
|
show_msg(MSGERR, "Error %d attempting to connect to SOCKS "
|
|
"server (%s)\n", errno, strerror(errno));
|