diff src/control.c @ 223:ffb1848a39db noffle

[svn] * src/util.c: Improve (correct) error detection when updating timestamp file. * src/content.h, src/content.c: Return Boolean success/fail from Cont_write. Also ensure cont.first isn't polluted in the event of a failed update. * src/client.c,src/control.c,src/fetch.c,src/noffle.c,src/post.c, src/pseudo.c: If Cont_write fails, don't do actions that need it to have worked. Typically, don't update first and last article numbers in group database. * src/server.c: If groupinfo.lastupdate is unreadable or corrupt, spot this and report it and give an explicit error when processing NNTP NEWGROUPS command.
author bears
date Sun, 09 Dec 2001 12:31:57 +0000
parents 24d4cd032da5
children 01755687c565
line wrap: on
line diff
--- a/src/control.c	Sun Dec 09 11:32:31 2001 +0000
+++ b/src/control.c	Sun Dec 09 12:31:57 2001 +0000
@@ -1,7 +1,7 @@
 /*
   control.c
 
-  $Id: control.c 316 2001-10-31 11:44:53Z bears $
+  $Id: control.c 342 2001-12-09 12:31:57Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -27,6 +27,7 @@
     Str server;
     Bool seen = FALSE;
     int res = CANCEL_OK;
+    Bool removeFromDb = TRUE;
 
     /* See if in outgoing and zap if so. */
     if ( Out_find( msgId, server ) )
@@ -60,14 +61,21 @@
 	{
 	    Cont_read( grp );
 	    Cont_delete( no );
-	    Cont_write();
+            /*
+             * If we don't manage to remove the overview, leave the message
+             * in the main database to avoid confusion. Yes, the message
+             * will not be cancelled properly for this group but we don't
+             * signal this to the calling routine.
+             */
+	    if ( Cont_write() )
+                Log_dbg( LOG_DBG_CONTROL,
+                         "Removed '%s' from group '%s'.",
+                         msgId, grp );
+            else
+                removeFromDb = FALSE;
 
 	    if ( ! Grp_local( grp ) && ! seen )
 		res = CANCEL_NEEDS_MSG;
-
-	    Log_dbg( LOG_DBG_CONTROL,
-		     "Removed '%s' from group '%s'.",
-		     msgId, grp );
 	}
 	else
 	{
@@ -75,7 +83,8 @@
 	}
     }
     del_Itl( refs );
-    Db_delete( msgId );
+    if ( removeFromDb )
+        Db_delete( msgId );
     Log_inf( "Message '%s' cancelled.", msgId );
     return res;
 }