diff src/database.c @ 300:994e9ab2c24f noffle

[svn] * src/database.c: Accept articles with no body, substituting a body of a single empty line. Also cast a scanf parameter to remove warning.
author bears
date Thu, 13 Feb 2003 10:04:01 +0000
parents baa6408d1bbc
children a04c52f87b6e
line wrap: on
line diff
--- a/src/database.c	Wed Feb 12 10:10:45 2003 +0000
+++ b/src/database.c	Thu Feb 13 10:04:01 2003 +0000
@@ -1,7 +1,7 @@
 /*
   database.c
 
-  $Id: database.c 414 2003-01-06 18:16:18Z bears $
+  $Id: database.c 433 2003-02-13 10:04:01Z bears $
 
   Uses GNU gdbm library. Using Berkeley db (included in libc6) was
   cumbersome. It is based on Berkeley db 1.85, which has severe bugs
@@ -146,7 +146,7 @@
         return FALSE;
     }
     p = Utl_getLn( t, p );
-    if ( ! p || sscanf( t, "%lu", &db.lastAccess ) != 1 )
+    if ( ! p || sscanf( t, "%lu", (unsigned long *)&db.lastAccess ) != 1 )
     {
         Log_err( "Entry in database '%s' is corrupt (lastAccess)", msgId );
         return FALSE;
@@ -306,8 +306,15 @@
 
     if ( artTxt == NULL )
     {
-	Log_err( "Article %s malformed: missing body", msgId );
-	return FALSE;
+	/*
+	 * This article has no body. Bereft of text it lies...
+	 *
+	 * I'm not completely sure how surprising the rest of
+	 * Noffle would find a body-less article, so substitute
+	 * an empty line.
+	 */
+	Log_inf( "Article %s malformed: missing body", msgId );
+	artTxt = "\n";
     }
 
     /* Read body */