diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2014-12-21 12:47:43 +0100 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2014-12-21 12:47:43 +0100 |
commit | 4ed9394c0c2ba0ae65a20861fa998d7b701f8640 (patch) | |
tree | 26ce1a60ca0b3062a872380782869cb775b89be4 /src/master.c | |
parent | bdb7e3800ccd7d04efb6bdb6535919c9de133541 (diff) | |
download | biruda-4ed9394c0c2ba0ae65a20861fa998d7b701f8640.tar.gz biruda-4ed9394c0c2ba0ae65a20861fa998d7b701f8640.tar.bz2 |
fixed output of worker messages in cli
Diffstat (limited to 'src/master.c')
-rw-r--r-- | src/master.c | 9 |
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; |