[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [leafnode-list] Bus errors on MacOS X with 2.0.0.alpha20030209a



Jari Lehtonen <jari@xxxxxx> writes:

>> Please let me know if this patch helps. If it does, your mergesort()
>> function is hosed. If it does not help, I'll have to dig somewhere else
>> in the leafnode code for the bug.
>
> Patch didn't help.

>From your backtrace, helped, but you did not get much farther. There's
another bug that I hope to fix with the patch below (leave the previous
patch in).

For some reason, I cannot reprocude this problem on Linux. I'll see if I
have more success on FreeBSD later.

> New backtrace:

How about this one? I haven't tested this, might be my memmove or memcpy
tolerate NULL pointers and just ignore the operation and Darwin crashes
into the brick wall.

Index: activutil.c
===================================================================
RCS file: /var/CVS/leafnode-2/activutil.c,v
retrieving revision 1.42
diff -u -r1.42 activutil.c
--- activutil.c	9 Feb 2003 23:41:10 -0000	1.42
+++ activutil.c	12 Mar 2003 23:45:37 -0000
@@ -551,15 +551,17 @@
  * pointers in the newsgroup structure!
  * (c) 2002 Joerg Dietrich
  */
-struct newsgroup *mvactive(struct newsgroup *a)
+/*@null@*/ struct newsgroup *mvactive(/*@null@*/ struct newsgroup *a)
 {
     static struct newsgroup *b;
 
+    oldactivesize = activesize;
+    if (a == NULL || activesize == 0) return NULL;
+
     b = (struct newsgroup *)critmalloc((1+activesize) *
 				       sizeof(struct newsgroup),
 				       "allocating active copy");
     (void)memcpy(b, a, (1+activesize) * sizeof(struct newsgroup));
-    oldactivesize = activesize;
     active = NULL;
     activesize = 0;
     return b;


-- 
Matthias Andree
leafnode-1 download: http://sourceforge.net/projects/leafnode/
leafnode-1 docs/new: http://mandree.home.pages.de/leafnode/
leafnode-2 homepage: http://mandree.home.pages.de/leafnode/beta/

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list