[eggheads-patches] PATCH: basegv2.patch

Peter 'Rattacresh' Backes rtc at rhrk.uni-kl.de
Wed Oct 13 19:50:21 CST 1999


This is the version of basegv.patch that should go into CVS 
(basegv.patch was intended to be a quickfix only). basegv splits up 
these ASSERTs in transfer.c so one knows where exactly where it 
failed and fixes other parts of the code that otherwise might segv in 
future versions of the bot.


-- Peter 'Rattacresh' Backes, rtc at rhrk.uni-kl.de

-------------- next part --------------
diff -urN eggdrop1.3.29/src/mod/console.mod/console.c eggdrop1.3.29+basegv2/src/mod/console.mod/console.c
--- eggdrop1.3.29/src/mod/console.mod/console.c	Wed Oct 13 20:52:14 1999
+++ eggdrop1.3.29+basegv2/src/mod/console.mod/console.c	Wed Oct 13 20:39:25 1999
@@ -105,6 +105,9 @@
 {
   struct console_info *ci = (struct console_info *) e->u.extra;
 
+  if (!ci && !buf)
+    return 1;
+  
   if (ci != buf) {
     if (ci) {
       ASSERT (ci->channel != NULL);
@@ -113,7 +116,7 @@
     }
     context;
 
-    e->u.extra = buf;
+    ci = e->u.extra = buf;
   }
 
   /* donut share console info */
diff -urN eggdrop1.3.29/src/mod/transfer.mod/transfer.c eggdrop1.3.29+basegv2/src/mod/transfer.mod/transfer.c
--- eggdrop1.3.29/src/mod/transfer.mod/transfer.c	Wed Oct 13 20:52:15 1999
+++ eggdrop1.3.29+basegv2/src/mod/transfer.mod/transfer.c	Wed Oct 13 20:41:50 1999
@@ -1146,7 +1146,8 @@
   char *par, *arg;
   struct filesys_stats *fs;
 
-  ASSERT (e != NULL && e->name != NULL);
+  ASSERT (e != NULL);
+  ASSERT (e->name != NULL);
   context;
   fs = user_malloc(sizeof(struct filesys_stats));
   bzero(fs, sizeof(struct filesys_stats));
@@ -1174,7 +1175,9 @@
   register struct filesys_stats *fs;
   struct list_type *l = user_malloc(sizeof(struct list_type));
 
-  ASSERT (e != NULL && e->name == NULL && e->u.extra != NULL);
+  ASSERT (e != NULL);
+  ASSERT (e->name == NULL);
+  ASSERT (e->u.extra != NULL);
   context;
   fs = e->u.extra;
   /* if you set it in the declaration, the ASSERT will be useless. ++rtc */
@@ -1193,7 +1196,8 @@
 {
   register struct filesys_stats *fs;
 
-  ASSERT (e != NULL && e->u.extra != NULL);
+  ASSERT (e != NULL);
+  ASSERT (e->u.extra != NULL);
   context;
   fs = e->u.extra;
   if (fprintf(f, "--FSTAT %09u %09u %09u %09u\n",
@@ -1244,7 +1248,8 @@
   char d[50];
 
   BADARGS(3, 4, " handle FSTAT ?u/d?");
-  ASSERT (e != NULL && e->u.extra != NULL);
+  ASSERT (e != NULL)
+  ASSERT (e->u.extra != NULL);
   fs = e->u.extra;
   if (argc == 3)
     simple_sprintf(d, "%u %u %u %u", fs->uploads, fs->upload_ks,
@@ -1282,7 +1287,9 @@
 {
   struct filesys_stats *fs;
 
-  ASSERT (e != NULL && e->u.extra != NULL);
+  ASSERT (e != NULL);
+  ASSERT (e->u.extra != NULL);
+
   fs = e->u.extra;
   dprintf(idx, "  FILES: %u download%s (%luk), %u upload%s (%luk)\n",
 	  fs->dnloads, (fs->dnloads == 1) ? "" : "s", fs->dnload_ks,
diff -urN eggdrop1.3.29/src/userent.c eggdrop1.3.29+basegv2/src/userent.c
--- eggdrop1.3.29/src/userent.c	Wed Oct 13 20:52:18 1999
+++ eggdrop1.3.29+basegv2/src/userent.c	Wed Oct 13 20:40:09 1999
@@ -357,9 +357,9 @@
     }
     contextnote("(sharebug) occurred in laston_set");
 
-    e->u.extra = buf;
+    li = e->u.extra = buf;
   }
-  /* donut share laston unfo */
+  /* donut share laston info */
   return 1;
 }
 
@@ -535,9 +535,10 @@
       nfree (bi);
     }
     contextnote("(sharebug) occurred in botaddr_set");
-    e->u.extra = buf;
+    bi = e->u.extra = buf;
   }
-  if (!noshare && !(u && (u->flags & USER_UNSHARED))) {
+  ASSERT (u != NULL);
+  if (bi && !noshare && !(u->flags & USER_UNSHARED)) {
     shareout(NULL, "c BOTADDR %s %s %d %d\n", u->handle,
              bi->address, bi->telnet_port, bi->relay_port);
   }


More information about the Patches mailing list