From 718fb33b293dbb8d72d4ef4644fcbd434a3c799b Mon Sep 17 00:00:00 2001 From: Clint Adams Date: Mon, 10 Sep 2001 12:37:21 +0000 Subject: stupid bugfixes --- ChangeLog | 3 ++- Src/Modules/tcp.c | 13 ++++++++----- 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; } } -- cgit 1.4.1