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

[PATCH] session: use unique EOF error message


Hi,

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


-Jon
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);
     session->session_state=SSH_SESSION_STATE_ERROR;
-    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));
+    }
     session->ssh_connection_callback(session);
 }
 
-- 
1.8.4.21.g992c386



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