problems using Unix PuTTY port forwarding. Sockets we create by
connect() are immediately set into nonblocking mode by fcntl, but
sockets we create by accept() were not. This trivial fix should help.
git-svn-id: svn://svn.tartarus.org/sgt/putty@7864
cda61777-01e9-0310-a592-
d414129be87e
#endif
socklen_t addrlen = sizeof(ss);
int t; /* socket of connection */
#endif
socklen_t addrlen = sizeof(ss);
int t; /* socket of connection */
memset(&ss, 0, addrlen);
t = accept(s->s, (struct sockaddr *)&ss, &addrlen);
memset(&ss, 0, addrlen);
t = accept(s->s, (struct sockaddr *)&ss, &addrlen);
+ fl = fcntl(t, F_GETFL);
+ if (fl != -1)
+ fcntl(t, F_SETFL, fl | O_NONBLOCK);
+
if (s->localhost_only &&
!sockaddr_is_loopback((struct sockaddr *)&ss)) {
close(t); /* someone let nonlocal through?! */
if (s->localhost_only &&
!sockaddr_is_loopback((struct sockaddr *)&ss)) {
close(t); /* someone let nonlocal through?! */