summary refs log tree commit diff
path: root/Src/Modules/zftp.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Modules/zftp.c')
-rw-r--r--Src/Modules/zftp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Src/Modules/zftp.c b/Src/Modules/zftp.c
index 8dda5f1a8..9408c7a1f 100644
--- a/Src/Modules/zftp.c
+++ b/Src/Modules/zftp.c
@@ -2679,6 +2679,13 @@ zfclose(int leaveparams)
     }
     if (zfsess->cin) {
 	fclose(zfsess->cin);
+	/*
+	 * We fdopen'd the TCP control fd; since we can't fdclose it,
+	 * we need to perform a full fclose, which invalidates the
+	 * TCP fd.
+	 */
+	if (fileno(zfsess->cin) == zfsess->control->fd)
+	    zfsess->control->fd = -1;
 	zfsess->cin = NULL;
     }
     if (zfsess->control) {