diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2014-12-24 13:37:44 +0100 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2014-12-24 13:37:44 +0100 |
commit | 1e6a472978fa7d1040170b3e13200ad39571befe (patch) | |
tree | 3d69dbcca15c2b2d591897dd80ae05349e4eb7d5 | |
parent | 94bd25e66a4704b8d9e604dc528205e4e9ce2217 (diff) | |
download | biruda-1e6a472978fa7d1040170b3e13200ad39571befe.tar.gz biruda-1e6a472978fa7d1040170b3e13200ad39571befe.tar.bz2 |
show truncation in outstanding worker messages
-rw-r--r-- | src/master.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/master.c b/src/master.c index b14acbe..e8caca9 100644 --- a/src/master.c +++ b/src/master.c @@ -462,16 +462,18 @@ void master_output_outstanding_messages( const char *name, char *s, size_t len ) execution_worker_data_t *wed = (execution_worker_data_t *)w->execution_data; if( wed->spool_file == NULL ) return; + + char *cur = s; + char *end = s + len; long end_pos = ftell( wed->spool_file ); if( len < end_pos - wed->read_pos + 3 ) { wed->read_pos = end_pos - len + 3; + cur += snprintf( cur, end - cur, "..\n" ); } fseek( wed->spool_file, wed->read_pos, SEEK_SET ); char line[1024]; - char *cur = s; - char *end = s + len; while( wed->read_pos < end_pos ) { fgets( line, sizeof( line ), wed->spool_file ); cur += snprintf( cur, end - cur, "%s", line ); |