From bbefa484f47ba659afa78b6a3c8621a17ed29e03 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 15 May 2002 20:38:17 +0000 Subject: 17166: Src/Modules/zftp.c: check fileno of zftp control connection before closing, not after --- ChangeLog | 5 +++++ Src/Modules/zftp.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7db1a2988..100466c0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-05-15 Peter Stephenson + + * 17166: Src/Modules/zftp.c: must check fileno of zftp control + connection before it's closed. + 2002-05-15 Sven Wischnowsky * 17163: Src/Zle/compcore.c: follow-up to 17135, diff --git a/Src/Modules/zftp.c b/Src/Modules/zftp.c index 80e09045c..de762e883 100644 --- a/Src/Modules/zftp.c +++ b/Src/Modules/zftp.c @@ -2678,14 +2678,15 @@ zfclose(int leaveparams) zfsendcmd("QUIT\r\n"); } 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. + * TCP fd. We need to do this before closing the FILE, since + * it's not usable afterwards. */ if (fileno(zfsess->cin) == zfsess->control->fd) zfsess->control->fd = -1; + fclose(zfsess->cin); zfsess->cin = NULL; } if (zfsess->control) { -- cgit 1.4.1