changeset 219:d9f314014f7a noffle

[svn] * src/content.c: Remove spurious temporary files and add a closedir() to terminate opendir()/readdir() sequence properly. * Updated NEWS ready for 1.1.1.
author bears
date Thu, 29 Nov 2001 22:16:06 +0000
parents 411b6ab1acb7
children 81277bc2c264
files ChangeLog NEWS src/content.c
diffstat 3 files changed, 27 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Nov 22 22:48:07 2001 +0000
+++ b/ChangeLog	Thu Nov 29 22:16:06 2001 +0000
@@ -1,9 +1,15 @@
+Thu Nov 29 2001 Jim Hague <jim.hague@acm.org>
+
+* src/content.c: Remove spurious temporary files and add a closedir()
+  to terminate opendir()/readdir() sequence properly.
+* Updated NEWS ready for 1.1.1.	
+	
 Thu Nov 22 2001 Jim Hague <jim.hague@acm.org>
 
 * Makefile.in,aclocal.m4,config.h.in,configure,configure.in
   docs/Makefile.in,src/Makefile.in: Regularise format of Noffle
   default parameters in configure.in and regenerate.
-*src/content.c,src/noffle.c: Correct bugfix in Conf_write().
+* src/content.c,src/noffle.c: Correct bugfix in Conf_write().
   Remove temporary file expiry, but skip temp files in
   Cont_nextGrp().
 	
@@ -34,7 +40,7 @@
 * src.util.c: Minor fix at Utl_parseNewsDate(); fixed SIGSEGV at
   Utl_getHeaderLn(). Header size limit still much too low.
 * docs/testing.txt: How to set up a testbench for noffle. Useless
-for most developers, but useful for beginners.
+  for most developers, but useful for beginners.
 
 Thu Nov  8 2001 Mirko Liß <mirko.liss@web.de>
 
--- a/NEWS	Thu Nov 22 22:48:07 2001 +0000
+++ b/NEWS	Thu Nov 29 22:16:06 2001 +0000
@@ -1,6 +1,13 @@
 Current development version:
 ----------------------------
 
+ * Spool directory and config file location now configurable.
+ * post-status filter added.
+ * Optional patterns to select groups for --fetch and --query. 
+
+1.1
+---
+
  * Use LIST instead of LIST ACTIVE if possible to help work with old servers.
  * Article filtering: see noffle.conf(5) for details.
  * Noffle no longer hangs if the connection breaks down during a fetch.
--- a/src/content.c	Thu Nov 22 22:48:07 2001 +0000
+++ b/src/content.c	Thu Nov 29 22:16:06 2001 +0000
@@ -1,7 +1,7 @@
 /*
   content.c
 
-  $Id: content.c 337 2001-11-22 22:48:07Z bears $
+  $Id: content.c 338 2001-11-29 22:16:06Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -322,6 +322,7 @@
     ASSERT( cont.dir );
     if ( ! ( d = readdir( cont.dir ) ) )
     {
+	closedir( cont.dir );
         cont.dir = NULL;
         return FALSE;
     }
@@ -329,15 +330,12 @@
         return FALSE;
     if ( d->d_name[0] == '.' )
     {
+	Str tmpfname;
+
 	/*
 	 * If it is '.' or '..', skip.
 	 * If it starts '.#', treat as a temporary file that didn't
-	 * get deleted for some reason and flag an error.
-	 * Otherwise weirdness lurks; log an error.
-	 *
-	 * N.B. Don't delete it! I'm not sure what happens to
-	 * readdir if you go around deleting stuff from the directory
-	 * between calls. The Single Unix Spec v2 isn't either.
+	 * get deleted for some reason and flag an error and delete it.
 	 */
 	switch( d->d_name[1] )
 	{
@@ -346,8 +344,13 @@
 	    break;
 
 	case '#':
-	    Log_err( "Bad temporary file %s in %s/overview - please delete",
-		     d->d_name, Cfg_spoolDir() );
+	    snprintf( tmpfname, MAXCHAR, "%s/overview/.#%d.%s",
+		      Cfg_spoolDir(), (int) getpid(), d->d_name ); 
+	    Log_err( "Bad temporary file %s - please delete",
+		     tmpfname );
+	    if ( unlink( tmpfname ) < 0 )
+		Log_err( "Unlink of %s failed: %s",
+			 tmpfname, strerror(errno) );
 	    break;
 
 	default: