summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2014-12-21 12:47:43 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2014-12-21 12:47:43 +0100
commit4ed9394c0c2ba0ae65a20861fa998d7b701f8640 (patch)
tree26ce1a60ca0b3062a872380782869cb775b89be4 /src
parentbdb7e3800ccd7d04efb6bdb6535919c9de133541 (diff)
downloadbiruda-4ed9394c0c2ba0ae65a20861fa998d7b701f8640.tar.gz
biruda-4ed9394c0c2ba0ae65a20861fa998d7b701f8640.tar.bz2
fixed output of worker messages in cli
Diffstat (limited to 'src')
-rw-r--r--src/cli.c2
-rw-r--r--src/master.c9
2 files changed, 7 insertions, 4 deletions
diff --git a/src/cli.c b/src/cli.c
index 6cf3401..0596b24 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -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;