[leafnode-list] fetchnews creates duplicate messages

Matthias Andree ma at dt.e-technik.uni-dortmund.de
Sun Aug 22 16:14:26 CEST 2004


Til Schubbe <t.schubbe at gmx.de> writes:

> after marking 3 article-bodies in slrn for download i got this:

> In
> http://www.dt.e-technik.uni-dortmund.de/pipermail/leafnode-list/2004q2/000384.html
> someone reported something similar, but I think not texpire is the
> problem but fetchnews is.

Indeed it is. This patch should fix your problem:

Index: fetchnews.c
===================================================================
RCS file: /var/CVS/leafnode-1/fetchnews.c,v
retrieving revision 1.174
diff -u -r1.174 fetchnews.c
--- fetchnews.c	24 May 2004 13:23:22 -0000	1.174
+++ fetchnews.c	22 Aug 2004 14:12:41 -0000
@@ -397,12 +397,21 @@
     xref = NULL;
     debug--;
     while ((l = getaline(f)) != NULL) {
-	if (!newsgroups && !strncmp(l, "Newsgroups:", 11))
-	    newsgroups = critstrdup(l + 11, "getbody");
-	if (!messageid && !strncmp(l, "Message-ID:", 11))
-	    messageid = critstrdup(l + 11, "getbody");
-	if (!xref && !strncmp(l, "Xref:", 5))
-	    xref = critstrdup(l + 5, "getbody");
+	if (!newsgroups && !strncmp(l, "Newsgroups:", 11)) {
+	    p = l+11;
+	    SKIPLWS(p);
+	    newsgroups = critstrdup(p, "getbody");
+	}
+	if (!messageid && !strncmp(l, "Message-ID:", 11)) {
+	    p = l+11;
+	    SKIPLWS(p);
+	    messageid = critstrdup(p, "getbody");
+	}
+	if (!xref && !strncmp(l, "Xref:", 5)) {
+	    p = l + 5;
+	    SKIPLWS(p);
+	    xref = critstrdup(p, "getbody");
+	}
     }
     debug = debugmode;
     fclose(f);
@@ -422,7 +431,7 @@
 
     xsnprintf(s, SIZE_s, "%lu", id);
     c = lookup(messageid);
-    unlink(c);			/* make space for new file */
+    log_unlink(c, 0);			/* make space for new file */
 
     if (!(f = fopen(c, "w"))) {
 	ln_log(LNLOG_SERR, LNLOG_CGROUP, "%s: cannot open %s for writing", group->name, c);


-- 
Matthias Andree

NOTE YOU WILL NOT RECEIVE MY MAIL IF YOU'RE USING SPF!
Encrypted mail welcome: my GnuPG key ID is 0x052E7D95 (PGP/MIME preferred)



More information about the leafnode-list mailing list