changeset 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 94ac4c72baf7
children 3b5b7f3fd71f
files ChangeLog src/database.c
diffstat 2 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Feb 12 10:10:45 2003 +0000
+++ b/ChangeLog	Thu Feb 13 10:04:01 2003 +0000
@@ -1,3 +1,8 @@
+Thu Feb 13 2003 Jim Hague <jim.hague@acm.org>
+
+* src/database.c: Accept articles with no body, substituting a body of a
+  single empty line. Also cast a scanf parameter to remove warning.
+	
 Wed Feb 12 2003 Jim Hague <jim.hague@acm.org>
 
 * NEWS,configure,configure.in,packages/redhat/noffle.spec: Update for 1.1.4.
--- 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 */