Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't exit in cleanup_and_fail #1202

Merged
merged 1 commit into from Sep 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/iperf_client_api.c
Expand Up @@ -651,13 +651,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) {
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
cJSON_AddStringToObject(test->json_top, "error", iperf_strerror(i_errno));
iperf_json_finish(test);
iflush(test);
return 0;
}
iflush(test);
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.
return -1;
}