Skip to content

Commit

Permalink
Fix issue esnet#1143 - make sure terminating error message is inside …
Browse files Browse the repository at this point in the history
…the JSON output
  • Loading branch information
davidBar-On authored and hanvari committed Jul 3, 2021
1 parent 1a69ad8 commit aae27e7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/iperf_client_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,13 @@ iperf_run_client(struct iperf_test * test)
return 0;

cleanup_and_fail:
iperf_errexit(test, "error - %s", iperf_strerror(i_errno));
iperf_client_end(test);
if (test->json_output)
iperf_json_finish(test);
if (test->json_output) {
if (iperf_json_finish(test) < 0)
return -1; // It is o.k. that error will be logged later outside the JSON output since its creation failed
}
iflush(test);
return -1;
return 0; // Return 0 and not -1 since all terminating function were done here.
// Also prevents error message logging outside the already closed JSON output.
}

0 comments on commit aae27e7

Please sign in to comment.