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

[leafnode-list] fetchnews patch



I am running leafnode 1.9.18 (because that's what Mandrake 8.1 comes with) 
and found a bug which causes it to run out of file descriptors if there are 
more than 1024 new articles when fetchnews is run (very likely if someone 
subscribes to several newsgroups within the past hour). The following patch 
fixes it; probably all the other "continue" statements in the same loop 
should be preceded by closing the file.

phma
----
--- leafnode-1.9.18.orig/fetchnews.c	Thu Nov 30 13:08:30 2000
+++ leafnode-1.9.18/fetchnews.c	Sat Jan 26 20:12:51 2002
@@ -1012,6 +1012,7 @@
 				 *hd[7] ? hd[7]+strlen(hnames[7]) : "");
 
 	if ( delaybody ) {
+	    syslog(LOG_DEBUG, "file delaybody close %s %x",c,(int)f);
 	    fclose( f );
 	    fetched++;
 	    continue;
@@ -1024,6 +1025,8 @@
 	    return server;
 	if ( sscanf( l, "%3d", &n ) != 1 || (n/10 != 22) ) {
 	    syslog( LOG_INFO, "%d: reply %s", stufftoget[i], l );
+	    syslog(LOG_DEBUG, "file not22 close %s %x",c,(int)f);
+	    fclose( f );
 	    continue;
 	}
 	debug = 0;
@@ -1036,6 +1039,7 @@
 	}
 	debug = debugmode;
 	fetched++;
+	syslog(LOG_DEBUG, "file close %s %x",c,(int)f);
 	fclose( f );
 	if ( !l ) {	/* article didn't terminate with a .: timeout */
 	    unlink( c );

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