[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Don't send EOF on channel more than once
[Thread Prev] | [Thread Next]
- Subject: [PATCH] Don't send EOF on channel more than once
- From: g4-lisz@xxxxxxxxxxxx
- Reply-to: libssh@xxxxxxxxxx
- Date: Tue, 9 Apr 2019 15:59:31 +0200
- To: libssh@xxxxxxxxxx
- Cc: Andreas Schneider <asn@xxxxxxxxxxxxxx>
Attached you find a patch for channels.c which prevents sending EOF on a channel more then once. Please comment. Till
From f8651e1831cf5273a3de2d22e2f4d7edf0fb457a Mon Sep 17 00:00:00 2001
From: Till Wimmer <g4-lisz@xxxxxxxxxxxx>
Date: Tue, 9 Apr 2019 15:57:03 +0200
Subject: [PATCH] Don't send EOF on channel more than once
Signed-off-by: Till Wimmer <g4-lisz@xxxxxxxxxxxx>
---
src/channels.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/channels.c b/src/channels.c
index 7b34c38..e65a256 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -1195,6 +1195,11 @@ int ssh_channel_send_eof(ssh_channel channel)
return rc;
}
+ /* If the EOF has already been sent we're done here. */
+ if(channel->local_eof != 0) {
+ return SSH_OK;
+ }
+
session = channel->session;
err = ssh_buffer_pack(session->out_buffer,
@@ -1257,10 +1262,7 @@ int ssh_channel_close(ssh_channel channel)
session = channel->session;
- if (channel->local_eof == 0) {
- rc = ssh_channel_send_eof(channel);
- }
-
+ rc = ssh_channel_send_eof(channel);
if (rc != SSH_OK) {
return rc;
}
--
2.7.4
| Re: [PATCH] Don't send EOF on channel more than once | g4-lisz@xxxxxxxxxxxx |