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

Re: [leafnode-list] artutil.c:58: mgetheader: Assertion failed.



Reiner Steib schrieb am 2003-10-02:

> running `applyfilter' after changing my filters, I got "artutil.c:58:
> mgetheader: Assertion ... failed.".  I've seen this message in several
> groups, when running "cd interesting.groups; for i in *;do echo
> $i;applyfilter $i;done".

Applyfilter truncates an article that has been filtered out, but it
assumes that some other part of leafnode weeds out these zero-sized
files. Does this patch help? Against 20031001a.

Index: applyfilter.c
===================================================================
RCS file: /var/CVS/leafnode-2/applyfilter.c,v
retrieving revision 1.33
diff -u -r1.33 applyfilter.c
--- applyfilter.c	29 Jul 2003 21:35:20 -0000	1.33
+++ applyfilter.c	3 Oct 2003 15:37:28 -0000
@@ -118,6 +118,7 @@
     }
 }
 
+/* remove LF in LF+whitespace sequences, in place */
 static void unfold(char *p)
 {
     char *s, *q;
@@ -237,9 +238,13 @@
 		printf("%s\n", de->d_name);
 	    }
 	}
-	stat(de->d_name, &st);
+	if (stat(de->d_name, &st))
+	    continue;
+	if (st.st_size == 0)
+	    score = TRUE;
 	if (S_ISREG(st.st_mode)
-	    && (fd = open(de->d_name, O_RDONLY))) {
+	    && (fd = open(de->d_name, O_RDONLY) >= 0))
+	{
 	    int ret = readheaders(fd, de->d_name, &l, &lsize);
 	    if (ret != -1) { unfold(l); }
 	    switch (ret) {
@@ -262,7 +267,9 @@
 	    close(fd);
 
 	    if (score && !dryrun) {
-		char *msgid = mgetheader("Message-ID:", l);
+		char *msgid;
+	        if (strlen(l))
+		    msgid = mgetheader("Message-ID:", l);
 		unlink(de->d_name);
 		/* delete stuff in message.id directory as well */
 		if (msgid) {

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