summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Wood <thomas.wood@intel.com>2014-09-26 15:16:21 +0100
committerThomas Wood <thomas.wood@intel.com>2014-09-30 17:54:02 +0100
commit756764a4e78ac8b6ea294924d272431f98f695ca (patch)
treed457dc87ae345f74802b7c9992fb783282ede1ee
parent519f377ddd6d43b7824f94f09eb3d3cabc39c6b9 (diff)
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>
-rw-r--r--lib/igt_core.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 03059c6e..02694624 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -928,6 +928,10 @@ bool __igt_fork_helper(struct igt_helper_process *proc)
*/
tmp_count = exit_handler_count;
exit_handler_count = 0;
+
+ /* ensure any buffers are flushed before fork */
+ fflush(NULL);
+
switch (pid = fork()) {
case -1:
exit_handler_count = tmp_count;
@@ -1019,6 +1023,9 @@ bool __igt_fork(void)
igt_assert(test_children);
}
+ /* ensure any buffers are flushed before fork */
+ fflush(NULL);
+
switch (test_children[num_test_children++] = fork()) {
case -1:
igt_assert(0);