From 630a04ad3ec15b8a683e461041db0666dfff2c71 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sat, 11 Feb 2006 19:52:53 +0000 Subject: [PATCH] unbelieveable, but close() can actually fail --- src/sync.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/sync.c b/src/sync.c index 9bb0a5e..36a981f 100644 --- a/src/sync.c +++ b/src/sync.c @@ -35,6 +35,15 @@ static const char *str_ms[] = { "master", "slave" }, *str_hl[] = { "push", "pull" }; +void +Fclose( FILE *f ) +{ + if (fclose( f ) == EOF) { + perror( "cannot close file" ); + exit( 1 ); + } +} + void Fprintf( FILE *f, const char *msg, ... ) { @@ -1168,8 +1177,8 @@ sync_boxes( store_t *ctx[], const char *names[], channel_conf_t *chan ) srec->status & S_EXPIRED ? "X" : "", fbuf ); } - fclose( nfp ); - fclose( jfp ); + Fclose( nfp ); + Fclose( jfp ); if (!(DFlags & KEEPJOURNAL)) { /* order is important! */ rename( nname, dname );