lib: ensure any buffers are flushed before fork

Flush any buffers before forking to prevent duplicated output.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
This commit is contained in:
Thomas Wood 2014-09-26 15:16:21 +01:00
parent 519f377ddd
commit 756764a4e7

View File

@ -928,6 +928,10 @@ bool __igt_fork_helper(struct igt_helper_process *proc)
*/ */
tmp_count = exit_handler_count; tmp_count = exit_handler_count;
exit_handler_count = 0; exit_handler_count = 0;
/* ensure any buffers are flushed before fork */
fflush(NULL);
switch (pid = fork()) { switch (pid = fork()) {
case -1: case -1:
exit_handler_count = tmp_count; exit_handler_count = tmp_count;
@ -1019,6 +1023,9 @@ bool __igt_fork(void)
igt_assert(test_children); igt_assert(test_children);
} }
/* ensure any buffers are flushed before fork */
fflush(NULL);
switch (test_children[num_test_children++] = fork()) { switch (test_children[num_test_children++] = fork()) {
case -1: case -1:
igt_assert(0); igt_assert(0);