diff --git a/src/iperf_api.c b/src/iperf_api.c index 50b9425..fba928c 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -802,7 +802,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv) } } - /* Set logging to a file if specified, otherwise stdout*/ + /* Set logging to a file if specified, otherwise use the default (stdout) */ if (test->logfile) { test->outfile = fopen(test->logfile, "a+"); if (test->outfile == NULL) { @@ -810,9 +810,6 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv) return -1; } } - else { - test->outfile = stdout; - } /* Check flag / role compatibility. */ if (test->role == 'c' && server_flag) { @@ -1514,6 +1511,9 @@ iperf_new_test() } memset(test->settings, 0, sizeof(struct iperf_settings)); + /* By default all output goes to stdout */ + test->outfile = stdout; + return test; }