[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [leafnode-list] artutil.c:58: mgetheader: Assertion failed.
I wrote:
> 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
The previous (3 Oct 2003) patch is broken, applyfilter henceforth tries
to read from stdout.
Back out that patch (use patch -R) and apply this newer one instead:
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 7 Oct 2003 23:00:37 -0000
@@ -118,6 +118,7 @@
}
}
+/* remove LF in LF+whitespace sequences, in place */
static void unfold(char *p)
{
char *s, *q;
@@ -221,6 +222,7 @@
kept = 0;
lsize = MAXHEADERSIZE + 1;
l = (char *)critmalloc(lsize, "Space for article");
+ ln_log(LNLOG_SINFO, LNLOG_CTOP, "Applying filters...");
while ((de = readdir(d)) != NULL) {
if (!isdigit((unsigned char)de->d_name[0])) {
/* no need to stat file */
@@ -237,9 +239,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 +268,9 @@
close(fd);
if (score && !dryrun) {
- char *msgid = mgetheader("Message-ID:", l);
+ char *msgid = NULL;
+ if (strlen(l))
+ msgid = mgetheader("Message-ID:", l);
unlink(de->d_name);
/* delete stuff in message.id directory as well */
if (msgid) {
@@ -295,7 +303,7 @@
}
} else
printf("could not open %s\n", de->d_name);
- }
+ } /* while readdir */
closedir(d);
free(l);
if (g->first > g->last) {
--
Matthias Andree
Encrypt your mail: my GnuPG key ID is 0x052E7D95
--
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list