summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-06-15 14:55:11 +0200
committerArtyom V. Poptsov <poptsov.artyom@gmail.com>2017-06-16 22:48:50 +0300
commit4ad9fcdfa9235f817c93850e9e8c9352ecf7e2fe (patch)
treefb5de51ff0b4f4f5df3b9c10ca4b8e24f0567988
parentnode.scm (node-eval): Always close the REPL channel. (diff)
downloadguile-ssh-4ad9fcdfa9235f817c93850e9e8c9352ecf7e2fe.tar.gz
libguile-ssh: Always reset the channel and sftp streams when closing ports.
See <https://bugs.gnu.org/26976>. * libguile-ssh/channel-type.c (ptob_close): Move SCM_SETSTREAM(channel, NULL) outside of "#if USING_GUILE_BEFORE_2_2". * libguile-ssh/sftp-file-type.c (ptob_close): Likewise. Signed-off-by: Artyom V. Poptsov <poptsov.artyom@gmail.com>
-rw-r--r--libguile-ssh/channel-type.c3
-rw-r--r--libguile-ssh/sftp-file-type.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/libguile-ssh/channel-type.c b/libguile-ssh/channel-type.c
index ff0df5e..ffcca64 100644
--- a/libguile-ssh/channel-type.c
+++ b/libguile-ssh/channel-type.c
@@ -229,10 +229,11 @@ ptob_close (SCM channel)
ssh_channel_free (ch->ssh_channel);
}
+ SCM_SETSTREAM (channel, NULL);
+
#if USING_GUILE_BEFORE_2_2
scm_gc_free (pt->write_buf, pt->write_buf_size, "port write buffer");
scm_gc_free (pt->read_buf, pt->read_buf_size, "port read buffer");
- SCM_SETSTREAM (channel, NULL);
return 0;
#endif
diff --git a/libguile-ssh/sftp-file-type.c b/libguile-ssh/sftp-file-type.c
index 8879924..f87cf03 100644
--- a/libguile-ssh/sftp-file-type.c
+++ b/libguile-ssh/sftp-file-type.c
@@ -224,10 +224,11 @@ ptob_close (SCM sftp_file)
sftp_close (fd->file);
}
+ SCM_SETSTREAM (sftp_file, NULL);
+
#if USING_GUILE_BEFORE_2_2
scm_gc_free (pt->write_buf, pt->write_buf_size, "port write buffer");
scm_gc_free (pt->read_buf, pt->read_buf_size, "port read buffer");
- SCM_SETSTREAM (sftp_file, NULL);
return 1;
#endif