Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Today's TCP Fix (TM) (4)



Today's Fix is in two parts:  first, fix the problem that if a user
closed a connection you couldn't get rid of the session.  I don't see
any alternative to simply deleting the session even if the close failed.

Second, if you unloaded the tcp module it didn't delete ztcp from the
builtin table, which was liable to cause a crash the next time the table
was scanned.

Index: Src/Modules/tcp.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/tcp.c,v
retrieving revision 1.31
diff -u -r1.31 tcp.c
--- Src/Modules/tcp.c	30 May 2002 15:16:21 -0000	1.31
+++ Src/Modules/tcp.c	5 Jun 2002 20:52:31 -0000
@@ -299,10 +299,7 @@
 	{
 	    err = close(sess->fd);
 	    if (err)
-	    {
 		zwarn("connection close failed: %e", NULL, errno);
-		return -1;
-	    }
 	}
 	zts_delete(sess);
 	return 0;
@@ -701,6 +698,7 @@
 cleanup_(Module m)
 {
     tcp_cleanup();
+    deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
     freelinklist(ztcp_sessions, (FreeFunc) ztcp_free_session);
     return 0;
 }

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
Work: pws@xxxxxxx
Web: http://www.pwstephenson.fsnet.co.uk



Messages sorted by: Reverse Date, Date, Thread, Author