comparison src/fetch.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 0340b9c17edc
comparison
equal deleted inserted replaced
222:bf290632d29e 223:ffb1848a39db
1 /* 1 /*
2 fetch.c 2 fetch.c
3 3
4 $Id: fetch.c 316 2001-10-31 11:44:53Z bears $ 4 $Id: fetch.c 342 2001-12-09 12:31:57Z bears $
5 */ 5 */
6 6
7 #if HAVE_CONFIG_H 7 #if HAVE_CONFIG_H
8 #include <config.h> 8 #include <config.h>
9 #endif 9 #endif
107 if ( next == GRP_RMT_NEXT_NOT_SUBSCRIBED ) 107 if ( next == GRP_RMT_NEXT_NOT_SUBSCRIBED )
108 next = first; 108 next = first;
109 if ( next == last + 1 ) 109 if ( next == last + 1 )
110 { 110 {
111 Log_inf( "No new articles in %s", name ); 111 Log_inf( "No new articles in %s", name );
112 Cont_write(); 112 if ( Cont_write() )
113 Grp_setFirstLast( name, Cont_first(), Cont_last() ); 113 Grp_setFirstLast( name, Cont_first(), Cont_last() );
114 Lock_closeDatabases(); 114 Lock_closeDatabases();
115 return STAT_OK; 115 return STAT_OK;
116 } 116 }
117 if ( first == 0 && last == 0 ) 117 if ( first == 0 && last == 0 )
118 { 118 {
119 Log_inf( "No articles in %s", name ); 119 Log_inf( "No articles in %s", name );
120 Cont_write(); 120 if ( Cont_write() )
121 Grp_setFirstLast( name, Cont_first(), Cont_last() ); 121 Grp_setFirstLast( name, Cont_first(), Cont_last() );
122 Lock_closeDatabases(); 122 Lock_closeDatabases();
123 return STAT_OK; 123 return STAT_OK;
124 } 124 }
125 if ( next > last + 1 ) 125 if ( next > last + 1 )
126 { 126 {