int len = snprintf(pidbuf, sizeof pidbuf, "%d\n", (int)pid);
#ifndef HAVE_FTRUNCATE
/* What can we do with a too-long file and no truncate? I guess we'll add extra newlines. */
- while (len < st1.st_size) /* We already verfified that size+1 chars fits in the buffer. */
+ while (len < st1.st_size) /* We already verified that st_size+1 chars fits in the buffer. */
pidbuf[len++] = '\n';
/* We don't need the buffer to end in a '\0' (and we may not have room to add it). */
#endif
*/
void log_exit(int code, const char *file, int line)
{
- rprintf(FLOG,"sent %s bytes received %s bytes total size %s\n",
- big_num(stats.total_written),
- big_num(stats.total_read),
- big_num(stats.total_size));
+ /* The receiving side's stats are split between 2 procs until the
+ * end of the run, so only the sender can output non-final info. */
+ if (code == 0 || am_sender) {
+ rprintf(FLOG,"sent %s bytes received %s bytes total size %s\n",
+ big_num(stats.total_written),
+ big_num(stats.total_read),
+ big_num(stats.total_size));
+ }
if (code != 0 && am_server != 2) {
const char *name;