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 | |
parent | bdb7e3800ccd7d04efb6bdb6535919c9de133541 (diff) | |
download | biruda-4ed9394c0c2ba0ae65a20861fa998d7b701f8640.tar.gz biruda-4ed9394c0c2ba0ae65a20861fa998d7b701f8640.tar.bz2 |
fixed output of worker messages in cli
-rw-r--r-- | src/cli.c | 2 | ||||
-rw-r--r-- | src/master.c | 9 |
2 files changed, 7 insertions, 4 deletions
@@ -212,7 +212,7 @@ static void print_worker_output( const char *worker_name ) len--; } if( len > 0 ) { - print_message( "worker %s:", worker_name ); + print_message( "output %s:", worker_name ); print_answer( data ); } } else if( ret == ERRNOLG ) { 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; |