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

Re: [leafnode-list] fetchnews-error-log: Cannot open



Andreas Muck <fam.muck@xxxxxxxxx> writes:

> I found the following error-message in my logfiles today:
>
> Jun  4 19:02:59 home fetchnews[14613]: Cannot open \
> 	/var/spool/news/interesting.groups/comp.security.announce \
> 	for reading
>
> And parallel the output from the cron-job running fetchnews:
>
> Date: Wed, 4 Jun 2003 19:01:00 +0200
> [...]
> Subject: Cron <news@home> test -x /usr/sbin/fetchnews && \
>     /usr/sbin/fetchnews -vv
>
> leafnode 1.9.41.rel: verbosity level is 2
> [...]
> unsubscribing from comp.security.announce
> [...]
>
> After all I didn't unsubscribe fron that group but there seem no
> messages to appear in comp.security.announce for a longer time. However,
> is that a reason to produce such an error-message?

Well, the error message is actually cosmetic, but here's a patch to
remove this bogus message:

Index: fetchnews.c
===================================================================
RCS file: /var/CVS/leafnode-1/fetchnews.c,v
retrieving revision 1.109
diff -u -r1.109 fetchnews.c
--- fetchnews.c	26 May 2003 12:42:47 -0000	1.109
+++ fetchnews.c	6 Jun 2003 13:51:02 -0000
@@ -78,7 +78,7 @@
 static void supersede(const char *msgid);
 #endif
 static unsigned long getgroup( /*@null@*/ struct newsgroup *g,
-			      unsigned long server);
+			      unsigned long server, int *);
 static int postarticles(void);
 
 static void
@@ -657,7 +657,7 @@
  * was previously read from this group on that server
  */
 static unsigned long
-getgroup(struct newsgroup *g, unsigned long server)
+getgroup(struct newsgroup *g, unsigned long server, int *unsubscribed)
 {
 #define HD_MAX 10
     static char *hd[HD_MAX];
@@ -836,8 +836,11 @@
 	    syslog(LOG_INFO, "unsubscribing from %s (current time: %ld): "
 		   "ctime age %ld, mtime age %ld", g->name, (long)now,
 		   (long)now - st.st_ctime, (long)now - st.st_mtime);
+	    *unsubscribed = 1;
 	    unlink(s);
 	    return server;
+	} else {
+	    *unsubscribed = 0;
 	}
     }
 
@@ -1859,6 +1862,7 @@
     }
     while ((de = readdir(d))) {
 	if (isalnum((unsigned char)*(de->d_name))) {
+	    int unsubscribed;
 	    g = findgroup(de->d_name);
 	    if (g != NULL) {
 		xsnprintf(s, SIZE_s, "%s ", g->name);
@@ -1869,17 +1873,18 @@
 		    l = strchr(l, ' ');
 		    srv = strtoul(l, &t, 10);
 		    if (t && !*t)
-			newserver = getgroup(g, srv);
+			newserver = getgroup(g, srv, &unsubscribed);
 		    else
-			newserver = getgroup(g, 1ul);
+			newserver = getgroup(g, 1ul, &unsubscribed);
 		} else {
-		    newserver = getgroup(g, 1ul);
+		    newserver = getgroup(g, 1ul, &unsubscribed);
 		}
 		/* run this independent of delaybody mode, because
 		 * the admin may have switched delaybody off recently,
 		 * and we still want users to be able to retrieve
 		 * articles. */
-		getmarked(g);
+		if (!unsubscribed)
+		    getmarked(g);
 		if (f != NULL) {
 		    fprintf(f, "%s %lu\n", g->name, newserver);
 		}


-- 
Matthias Andree

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