From: simon Date: Wed, 27 Feb 2002 22:45:52 +0000 (+0000) Subject: Set SSH socket variable to NULL if connect() fails. Failure to do X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/67c4ba2e881ecabdbe39f665b5b36ec58cab7007?ds=sidebyside Set SSH socket variable to NULL if connect() fails. Failure to do this was causing PSCP to hang indefinitely after reporting Connection Refused. git-svn-id: svn://svn.tartarus.org/sgt/putty@1569 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/ssh.c b/ssh.c index 270d76b0..4fb0822a 100644 --- a/ssh.c +++ b/ssh.c @@ -1873,8 +1873,10 @@ static char *connect_to_host(char *host, int port, char **realhost, int nodelay) logevent(buf); } s = sk_new(addr, port, 0, 1, nodelay, &fn_table_ptr); - if ((err = sk_socket_error(s))) + if ((err = sk_socket_error(s))) { + s = NULL; return err; + } #ifdef FWHACK sk_write(s, "connect ", 8);