From: Simon Tatham Date: Sun, 8 Sep 2013 07:14:56 +0000 (+0000) Subject: Pass an error message through to sshfwd_unclean_close. X-Git-Tag: 0.64~154 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=8e7b0d0e4b75dbe5239dd7c4197cc60885196a6e;p=PuTTY.git Pass an error message through to sshfwd_unclean_close. We have access to one at every call site, so there's really no reason not to send it through to ssh.c to be logged. [originally from svn r10038] --- diff --git a/portfwd.c b/portfwd.c index 00cff5ee..a93bb066 100644 --- a/portfwd.c +++ b/portfwd.c @@ -88,7 +88,7 @@ static int pfd_closing(Plug plug, const char *error_msg, int error_code, * Socket error. Slam the connection instantly shut. */ if (pr->c) { - sshfwd_unclean_close(pr->c); + sshfwd_unclean_close(pr->c, error_msg); } else { /* * We might not have an SSH channel, if a socket error diff --git a/ssh.c b/ssh.c index f0a70c9a..7fabb839 100644 --- a/ssh.c +++ b/ssh.c @@ -4302,7 +4302,7 @@ void sshfwd_write_eof(struct ssh_channel *c) ssh_channel_try_eof(c); } -void sshfwd_unclean_close(struct ssh_channel *c) +void sshfwd_unclean_close(struct ssh_channel *c, const char *err) { Ssh ssh = c->ssh; @@ -4312,12 +4312,13 @@ void sshfwd_unclean_close(struct ssh_channel *c) switch (c->type) { case CHAN_X11: x11_close(c->u.x11.s); - logevent("Forwarded X11 connection terminated due to local error"); + logeventf(ssh, "Forwarded X11 connection terminated due to local " + "error: %s", err); break; case CHAN_SOCKDATA: case CHAN_SOCKDATA_DORMANT: pfd_close(c->u.pfd.s); - logevent("Forwarded port closed due to local error"); + logeventf(ssh, "Forwarded port closed due to local error: %s", err); break; } c->type = CHAN_ZOMBIE; diff --git a/ssh.h b/ssh.h index 031fd974..5ddfcf34 100644 --- a/ssh.h +++ b/ssh.h @@ -11,7 +11,7 @@ struct ssh_channel; extern int sshfwd_write(struct ssh_channel *c, char *, int); extern void sshfwd_write_eof(struct ssh_channel *c); -extern void sshfwd_unclean_close(struct ssh_channel *c); +extern void sshfwd_unclean_close(struct ssh_channel *c, const char *err); extern void sshfwd_unthrottle(struct ssh_channel *c, int bufsize); /* diff --git a/x11fwd.c b/x11fwd.c index 895d8a99..d848b218 100644 --- a/x11fwd.c +++ b/x11fwd.c @@ -510,7 +510,7 @@ static int x11_closing(Plug plug, const char *error_msg, int error_code, /* * Socket error. Slam the connection instantly shut. */ - sshfwd_unclean_close(pr->c); + sshfwd_unclean_close(pr->c, error_msg); } else { /* * Ordinary EOF received on socket. Send an EOF on the SSH