Mercurial > noffle
diff src/content.c @ 218:411b6ab1acb7 noffle
[svn] *src/content.c,src/noffle.c: Correct bugfix in Conf_write().
Remove temporary file expiry, but skip temp files in
Cont_nextGrp().
author | bears |
---|---|
date | Thu, 22 Nov 2001 22:48:07 +0000 |
parents | f0acb9366e4f |
children | d9f314014f7a |
line wrap: on
line diff
--- a/src/content.c Thu Nov 22 22:25:12 2001 +0000 +++ b/src/content.c Thu Nov 22 22:48:07 2001 +0000 @@ -1,7 +1,7 @@ /* content.c - $Id: content.c 332 2001-11-22 12:05:11Z mirkol $ + $Id: content.c 337 2001-11-22 22:48:07Z bears $ */ #if HAVE_CONFIG_H @@ -263,6 +263,8 @@ { if ( unlink( tmpfname ) < 0 ) Log_err( "Unlink of %s failed: %s", tmpfname, strerror( errno ) ); + if ( unlink( cont.file ) < 0 ) + Log_err( "Unlink of %s failed: %s", cont.file, strerror( errno ) ); else { cont.dirty = FALSE; @@ -325,6 +327,36 @@ } if ( ! d->d_name ) return FALSE; + if ( d->d_name[0] == '.' ) + { + /* + * If it is '.' or '..', skip. + * If it starts '.#', treat as a temporary file that didn't + * get deleted for some reason and flag an error. + * Otherwise weirdness lurks; log an error. + * + * N.B. Don't delete it! I'm not sure what happens to + * readdir if you go around deleting stuff from the directory + * between calls. The Single Unix Spec v2 isn't either. + */ + switch( d->d_name[1] ) + { + case '\0': + case '.': + break; + + case '#': + Log_err( "Bad temporary file %s in %s/overview - please delete", + d->d_name, Cfg_spoolDir() ); + break; + + default: + Log_err( "Unknown file %s in %s/overview - please delete", + d->d_name, Cfg_spoolDir() ); + break; + } + return Cont_nextGrp( result ); + } Utl_cpyStr( result, d->d_name ); result[ MAXCHAR - 1 ] = '\0'; return TRUE; @@ -341,7 +373,5 @@ Log_err( "Cannot open %s", name ); return FALSE; } - Cont_nextGrp( result ); /* "." */ - Cont_nextGrp( result ); /* ".." */ return Cont_nextGrp( result ); }