[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] session: use unique EOF error message


Attached is a patch to improve the error message
that is set when a session encounters EOF.

From ab0ca329519f334723ff129be03df99fa035ae8d Mon Sep 17 00:00:00 2001
From: Jon Simons <jon@xxxxxxxxxxxxx>
Date: Fri, 31 Jan 2014 16:55:22 -0800
Subject: [PATCH] session: use unique EOF error message

Use a unique error message for the EOF case in the session socket exception
handler.  This changes the error string obtained with ssh_get_error from
"Socket error: Success" to the more helpful "Socket received EOF".
 src/session.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/session.c b/src/session.c
index 71d4548..2b5d002 100644
--- a/src/session.c
+++ b/src/session.c
@@ -696,7 +696,11 @@ void ssh_socket_exception_callback(int code, int errno_code, void *user){
     SSH_LOG(SSH_LOG_RARE,"Socket exception callback: %d (%d)",code, errno_code);
-    ssh_set_error(session,SSH_FATAL,"Socket error: %s",strerror(errno_code));
+    if (code == SSH_SOCKET_EXCEPTION_EOF) {
+        ssh_set_error(session, SSH_FATAL, "Socket received EOF");
+    } else {
+        ssh_set_error(session, SSH_FATAL, "Socket error: %s", strerror(errno_code));
+    }

Re: [PATCH] session: use unique EOF error messageAndreas Schneider <asn@xxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org