Mercurial > noffle
changeset 193:021d145e34e9 noffle
[svn] * src/fetch.c: Only leave articles in the requested list if the error
fetching them was fatal. Otherwise article requests will accumulate
indefinitely (e.g retrieving through NNTPcache when it can't find
the body of an article, now or event. Yes, this happened to me; I
had nearly 2000 requests backed up and never being cleared).
* src/group.c: The weekend's change introduced code that causes a bus
error on Sparc ( *(time_t *)p = xxx ). Replace with a safe memcpy,
and also use memcpy when reading the Entry and time items to remove
warnings on Sparc compilation.
author | bears |
---|---|
date | Mon, 22 Oct 2001 14:41:43 +0100 |
parents | b9ef99708d1c |
children | a4e9a20e50e5 |
files | ChangeLog src/fetch.c src/group.c |
diffstat | 3 files changed, 31 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Oct 21 12:00:12 2001 +0100 +++ b/ChangeLog Mon Oct 22 14:41:43 2001 +0100 @@ -1,3 +1,15 @@ +Mon Oct 22 2001 Jim Hague <jim.hague@acm.org> + +* src/fetch.c: Only leave articles in the requested list if the error + fetching them was fatal. Otherwise article requests will accumulate + indefinitely (e.g retrieving through NNTPcache when it can't find + the body of an article, now or event. Yes, this happened to me; I + had nearly 2000 requests backed up and never being cleared). +* src/group.c: The weekend's change introduced code that causes a bus + error on Sparc ( *(time_t *)p = xxx ). Replace with a safe memcpy, + and also use memcpy when reading the Entry and time items to remove + warnings on Sparc compilation. + Sun Oct 21 2001 Jim Hague <jim.hague@acm.org> * docs/noffle.conf.5,src/noffle.c: Duh! Do unsubscribing the simple way.
--- a/src/fetch.c Sun Oct 21 12:00:12 2001 +0100 +++ b/src/fetch.c Mon Oct 22 14:41:43 2001 +0100 @@ -1,7 +1,7 @@ /* fetch.c - $Id: fetch.c 307 2001-09-12 20:33:44Z bears $ + $Id: fetch.c 312 2001-10-22 13:41:43Z bears $ */ #if HAVE_CONFIG_H @@ -214,7 +214,7 @@ ASSERT( Lock_gotLock() ); stat = Client_retrieveArtList( list, artcnt, artmax ); - if ( stat != STAT_OK ) + if ( IS_FATAL( stat ) ) return stat; p = list; while ( ( p = Utl_getLn( msgId, p ) ) )
--- a/src/group.c Sun Oct 21 12:00:12 2001 +0100 +++ b/src/group.c Mon Oct 22 14:41:43 2001 +0100 @@ -7,7 +7,7 @@ loadGrp() and saveGrp(). This is done transparently. Access to the groups database is done by group name, by the functions defined in group.h. - $Id: group.c 310 2001-10-20 13:23:46Z bears $ + $Id: group.c 312 2001-10-22 13:41:43Z bears $ */ #if HAVE_CONFIG_H @@ -91,7 +91,12 @@ Utl_cpyStr( grp.name, "" ); } -/* Load group info from gdbm-database into global struct grp */ +/* + * Load group info from gdbm-database into global struct grp + * + * Note use of memcpy when packing buffer; avoids pointer alignment + * problems. + */ static Bool loadGrp( const char *name ) { @@ -106,7 +111,7 @@ val = gdbm_fetch( grp.dbf, key ); if ( val.dptr == NULL ) return FALSE; - grp.entry = *( (Entry *)val.dptr ); + memcpy( &grp.entry, val.dptr, sizeof( grp.entry ) ); p = val.dptr + sizeof( grp.entry ); Utl_cpyStr( grp.serv, p ); p += strlen( p ) + 1; @@ -127,7 +132,7 @@ grp.postAllow = p[ 0 ]; p++; if ( p - val.dptr < val.dsize ) - grp.lastPost = *((time_t *)p); + memcpy( &grp.lastPost, p, sizeof( grp.lastPost ) ); } Utl_cpyStr( grp.name, name ); @@ -135,7 +140,12 @@ return TRUE; } -/* Save group info from global struct grp into gdbm-database */ +/* + * Save group info from global struct grp into gdbm-database + * + * Note use of memcpy when packing buffer; avoids pointer alignment + * problems. + */ static void saveGrp( void ) { @@ -151,7 +161,7 @@ sizeof( grp.entry ) + lenServ + lenDsc + 2 + sizeof( char ) + sizeof( time_t ); buf = malloc( bufLen ); - memcpy( buf, (void *)&grp.entry, sizeof( grp.entry ) ); + memcpy( buf, &grp.entry, sizeof( grp.entry ) ); p = (char *)buf + sizeof( grp.entry ); strcpy( p, grp.serv ); p += lenServ + 1; @@ -159,7 +169,7 @@ p += lenDsc + 1; p[ 0 ] = grp.postAllow; p++; - *((time_t *) p) = grp.lastPost; + memcpy( p, &grp.lastPost, sizeof( grp.lastPost ) ); key.dptr = (void *)grp.name; key.dsize = strlen( grp.name ) + 1; val.dptr = buf;