1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-19 21:44:11 +01:00

17166: Src/Modules/zftp.c: check fileno of zftp control

connection before closing, not after
This commit is contained in:
Peter Stephenson 2002-05-15 20:38:17 +00:00
parent cd50acd08d
commit bbefa484f4
2 changed files with 8 additions and 2 deletions

@ -1,3 +1,8 @@
2002-05-15 Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
* 17166: Src/Modules/zftp.c: must check fileno of zftp control
connection before it's closed.
2002-05-15 Sven Wischnowsky <wischnow@zsh.org> 2002-05-15 Sven Wischnowsky <wischnow@zsh.org>
* 17163: Src/Zle/compcore.c: follow-up to 17135, * 17163: Src/Zle/compcore.c: follow-up to 17135,

@ -2678,14 +2678,15 @@ zfclose(int leaveparams)
zfsendcmd("QUIT\r\n"); zfsendcmd("QUIT\r\n");
} }
if (zfsess->cin) { if (zfsess->cin) {
fclose(zfsess->cin);
/* /*
* We fdopen'd the TCP control fd; since we can't fdclose it, * We fdopen'd the TCP control fd; since we can't fdclose it,
* we need to perform a full fclose, which invalidates the * 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) if (fileno(zfsess->cin) == zfsess->control->fd)
zfsess->control->fd = -1; zfsess->control->fd = -1;
fclose(zfsess->cin);
zfsess->cin = NULL; zfsess->cin = NULL;
} }
if (zfsess->control) { if (zfsess->control) {