Mercurial > noffle
comparison src/server.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 | f8a91e2b4060 |
comparison
equal
deleted
inserted
replaced
222:bf290632d29e | 223:ffb1848a39db |
---|---|
1 /* | 1 /* |
2 server.c | 2 server.c |
3 | 3 |
4 $Id: server.c 316 2001-10-31 11:44:53Z bears $ | 4 $Id: server.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 |
936 putSyntax( cmd ); | 936 putSyntax( cmd ); |
937 return TRUE; | 937 return TRUE; |
938 } | 938 } |
939 snprintf( file, MAXCHAR, "%s/groupinfo.lastupdate", Cfg_spoolDir() ); | 939 snprintf( file, MAXCHAR, "%s/groupinfo.lastupdate", Cfg_spoolDir() ); |
940 t = getTimeInSeconds( year, mon, day, hour, min, sec ); | 940 t = getTimeInSeconds( year, mon, day, hour, min, sec ); |
941 | |
942 if ( ! Utl_getStamp( &lastUpdate, file ) ) | |
943 { | |
944 /* Can't get stamp. Put out error message. */ | |
945 putStat( STAT_PROGRAM_FAULT, "Server error reading %s", file ); | |
946 return TRUE; | |
947 } | |
948 | |
941 putStat( STAT_NEW_GRP_FOLLOW, "New groups since %s", arg ); | 949 putStat( STAT_NEW_GRP_FOLLOW, "New groups since %s", arg ); |
942 | 950 |
943 if ( ! Utl_getStamp( &lastUpdate, file ) | 951 if ( t == (time_t)-1 || t <= lastUpdate ) |
944 || t == (time_t)-1 || t <= lastUpdate ) | |
945 { | 952 { |
946 if ( Grp_firstGrp( &g ) ) | 953 if ( Grp_firstGrp( &g ) ) |
947 do | 954 do |
948 if ( Grp_created( g ) > t ) | 955 if ( Grp_created( g ) > t ) |
949 putGrp( g ); | 956 putGrp( g ); |