aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-12-10 10:21:04 +0100
committerAndreas Schneider <asn@cryptomilk.org>2019-01-09 15:31:35 +0100
commit42bc98ed1d1464b450ec8b2eee58273ce886f9e9 (patch)
tree7b65f6b20386d429563467b203dc37d13c96ffe3
parenta1df0bd63a3061c696f163dfb131d2ded666a094 (diff)
downloadlibssh-master-poll.tar.gz
libssh-master-poll.tar.xz
libssh-master-poll.zip
socket: Set socket error to get better error messagesmaster-poll
We do not want an error for ssh_socket_close() here. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/socket.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/socket.c b/src/socket.c
index 9823d8e1..f297bcf7 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -244,8 +244,11 @@ int ssh_socket_pollcallback(struct ssh_poll_handle_struct *p,
if (rc < 0) {
err = errno;
}
- s->last_errno = err;
ssh_socket_close(s);
+ /* Overwrite ssh_socket_close() error with the real socket error */
+ s->last_errno = err;
+ errno = err;
+
if (s->callbacks != NULL && s->callbacks->connected != NULL) {
s->callbacks->connected(SSH_SOCKET_CONNECTED_ERROR,
err,