about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2001-09-10 12:37:21 +0000
committerClint Adams <clint@users.sourceforge.net>2001-09-10 12:37:21 +0000
commit718fb33b293dbb8d72d4ef4644fcbd434a3c799b (patch)
treed978d1574d887776c219e46e07e969b5782555e1
parentcb0f8a08c7f8d95cdea766e8fd3726af49bef737 (diff)
downloadzsh-718fb33b293dbb8d72d4ef4644fcbd434a3c799b.tar.gz
zsh-718fb33b293dbb8d72d4ef4644fcbd434a3c799b.tar.xz
zsh-718fb33b293dbb8d72d4ef4644fcbd434a3c799b.zip
stupid bugfixes
-rw-r--r--ChangeLog3
-rw-r--r--Src/Modules/tcp.c13
2 files changed, 10 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 9fdb41625..353fe460e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,8 @@
 
 	* unposted: Src/Modules/tcp.c:
 	don't segfault on -a if
-	the session table is empty.
+	the session table is empty,
+	and other fixes.
 
 	* 15772: Src/Modules/tcp.c:
 	add -t (test) for ztcp.
diff --git a/Src/Modules/tcp.c b/Src/Modules/tcp.c
index 0a81ba9db..bdc842f40 100644
--- a/Src/Modules/tcp.c
+++ b/Src/Modules/tcp.c
@@ -282,6 +282,8 @@ zts_delete(Tcp_session sess)
 
     tsess = zts_head();
 
+    if(!sess) return 1;
+
     if (tsess == sess)
     {
 	ztcp_head = sess->next;
@@ -289,15 +291,16 @@ zts_delete(Tcp_session sess)
 	return 0;
     }
 
-    while((tsess->next != sess) && (tsess->next))
-    {
+    while((tsess->next != sess) && (tsess->next)) {
 	tsess = zts_next(tsess);
     }
 
     if (!tsess->next) return 1;
 
-    tsess->next = tsess->next->next;
-    free(tsess->next);
+    if (ztcp_tail == sess)
+	    ztcp_tail = tsess;
+    tsess->next = sess->next;
+    free(sess);
     return 0;
 
 }
@@ -417,7 +420,7 @@ bin_ztcp(char *nam, char **args, char *ops, int func)
 	    }
 	    else
 	    {
-		zwarnnam(nam, "fd not found in tcp table", NULL, 0);
+		zwarnnam(nam, "fd %s not found in tcp table", args[0], 0);
 		return 1;
 	    }
 	}