summaryrefslogtreecommitdiff
path: root/src/master.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/master.c')
-rw-r--r--src/master.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/master.c b/src/master.c
index b807e81..d22a489 100644
--- a/src/master.c
+++ b/src/master.c
@@ -330,8 +330,8 @@ static int master_output_init( const char *spool_dir, const char *name )
execution_worker_data_t *wed = (execution_worker_data_t *)worker->execution_data;
if( wed->spool_file != NULL ) {
fprintf( stderr, "WARNING: truncating old output file of worker '%s'\n", name );
- unlink( filename );
}
+ unlink( filename );
wed->spool_file = fopen( filename, "a+" );
wed->read_pos = 0;
@@ -347,8 +347,11 @@ static int master_output_free( const char *name )
execution_worker_data_t *wed = (execution_worker_data_t *)worker->execution_data;
if( wed->spool_file != NULL ) {
- fclose( wed->spool_file );
- wed->spool_file = NULL;
+ long end_pos = ftell( wed->spool_file );
+ if( wed->read_pos >= end_pos ) {
+ fclose( wed->spool_file );
+ wed->spool_file = NULL;
+ }
}
return 0;