Mercurial > noffle
comparison 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 |
comparison
equal
deleted
inserted
replaced
217:b4f1731a6470 | 218:411b6ab1acb7 |
---|---|
1 /* | 1 /* |
2 content.c | 2 content.c |
3 | 3 |
4 $Id: content.c 332 2001-11-22 12:05:11Z mirkol $ | 4 $Id: content.c 337 2001-11-22 22:48:07Z 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 |
261 */ | 261 */ |
262 if ( ! anythingWritten ) | 262 if ( ! anythingWritten ) |
263 { | 263 { |
264 if ( unlink( tmpfname ) < 0 ) | 264 if ( unlink( tmpfname ) < 0 ) |
265 Log_err( "Unlink of %s failed: %s", tmpfname, strerror( errno ) ); | 265 Log_err( "Unlink of %s failed: %s", tmpfname, strerror( errno ) ); |
266 if ( unlink( cont.file ) < 0 ) | |
267 Log_err( "Unlink of %s failed: %s", cont.file, strerror( errno ) ); | |
266 else | 268 else |
267 { | 269 { |
268 cont.dirty = FALSE; | 270 cont.dirty = FALSE; |
269 cont.first = cont.last + 1; | 271 cont.first = cont.last + 1; |
270 } | 272 } |
323 cont.dir = NULL; | 325 cont.dir = NULL; |
324 return FALSE; | 326 return FALSE; |
325 } | 327 } |
326 if ( ! d->d_name ) | 328 if ( ! d->d_name ) |
327 return FALSE; | 329 return FALSE; |
330 if ( d->d_name[0] == '.' ) | |
331 { | |
332 /* | |
333 * If it is '.' or '..', skip. | |
334 * If it starts '.#', treat as a temporary file that didn't | |
335 * get deleted for some reason and flag an error. | |
336 * Otherwise weirdness lurks; log an error. | |
337 * | |
338 * N.B. Don't delete it! I'm not sure what happens to | |
339 * readdir if you go around deleting stuff from the directory | |
340 * between calls. The Single Unix Spec v2 isn't either. | |
341 */ | |
342 switch( d->d_name[1] ) | |
343 { | |
344 case '\0': | |
345 case '.': | |
346 break; | |
347 | |
348 case '#': | |
349 Log_err( "Bad temporary file %s in %s/overview - please delete", | |
350 d->d_name, Cfg_spoolDir() ); | |
351 break; | |
352 | |
353 default: | |
354 Log_err( "Unknown file %s in %s/overview - please delete", | |
355 d->d_name, Cfg_spoolDir() ); | |
356 break; | |
357 } | |
358 return Cont_nextGrp( result ); | |
359 } | |
328 Utl_cpyStr( result, d->d_name ); | 360 Utl_cpyStr( result, d->d_name ); |
329 result[ MAXCHAR - 1 ] = '\0'; | 361 result[ MAXCHAR - 1 ] = '\0'; |
330 return TRUE; | 362 return TRUE; |
331 } | 363 } |
332 | 364 |
339 if ( ! ( cont.dir = opendir( name ) ) ) | 371 if ( ! ( cont.dir = opendir( name ) ) ) |
340 { | 372 { |
341 Log_err( "Cannot open %s", name ); | 373 Log_err( "Cannot open %s", name ); |
342 return FALSE; | 374 return FALSE; |
343 } | 375 } |
344 Cont_nextGrp( result ); /* "." */ | |
345 Cont_nextGrp( result ); /* ".." */ | |
346 return Cont_nextGrp( result ); | 376 return Cont_nextGrp( result ); |
347 } | 377 } |