Author: Ghostwolf <foxxe@wtfs.net>
authorJoseph Bongaarts <foxxe@wtfs.net>
Sun, 10 Mar 2002 10:17:14 +0000 (10:17 +0000)
committerJoseph Bongaarts <foxxe@wtfs.net>
Sun, 10 Mar 2002 10:17:14 +0000 (10:17 +0000)
Log message:
Don't remove clients from the list that aren't actually in the list.

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@670 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/list.c

index d3b33e789e6d35a13c2272595084bf6cb7213929..e5bc07c2a5873e11b410e746c0dffc18744cc0ee 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2002-03-10 Joseph Bongaarts <foxxe@wtfs.net>
+
+       * ircd/list.c: Don't remove clients from the linked list
+       that aren't actually in the list.
+       
 2002-03-08  Carlo Wood  <run@alinoe.com>
        * include/channel.h: Added CHFL_BURST_ALREADY_OPPED
        and CHFL_BURST_ALREADY_VOICED.
index ebb637e741482b82737c1dcbcf49bea896af52bd..79dab30c1ad1ba66664e4ff557e3238e555c0182 100644 (file)
@@ -312,17 +312,22 @@ void remove_client_from_list(struct Client *cptr)
   assert(con_verify(cli_connect(cptr)));
   assert(!cli_prev(cptr) || cli_verify(cli_prev(cptr)));
   assert(!cli_next(cptr) || cli_verify(cli_next(cptr)));
+  assert(!IsMe(cptr));
 
-  if (cli_prev(cptr))
-    cli_next(cli_prev(cptr)) = cli_next(cptr);
-  else {
-    GlobalClientList = cli_next(cptr);
-    if (GlobalClientList)
+  /* Only try to remove cptr from the list if it IS in the list.
+   * cli_next(cptr) cannot be NULL here, as &me is always the end
+   * the list, and we never remove &me.    -GW 
+   */
+  if(cli_next(cptr))
+  {
+    if (cli_prev(cptr))
+      cli_next(cli_prev(cptr)) = cli_next(cptr);
+    else {
+      GlobalClientList = cli_next(cptr);
       cli_prev(GlobalClientList) = 0;
-  }
-  if (cli_next(cptr))
+    }
     cli_prev(cli_next(cptr)) = cli_prev(cptr);
-
+  }
   cli_next(cptr) = cli_prev(cptr) = 0;
 
   if (IsUser(cptr) && cli_user(cptr)) {