[LTP] [PATCH v3 3/3] safe_fork() should use tst_flush() instead of fflush()

Michael Moese mmoese@suse.de
Fri Mar 9 15:16:09 CET 2018


safe_fork() should not use fflush(stdout). This commit makes use of
the the newly added tst_flush(), which flushes, in fact, both stdout
and stderr.
In addition, tests output their results to stderr, so flushing stdout
here is simply wrong.

Signed-off-by: Michael Moese <mmoese@suse.de>
---
 lib/tst_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/tst_test.c b/lib/tst_test.c
index 9b4f43828..7069bbc5e 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -380,7 +380,7 @@ pid_t safe_fork(const char *filename, unsigned int lineno)
 	if (!tst_test->forks_child)
 		tst_brk(TBROK, "test.forks_child must be set!");
 
-	fflush(stdout);
+	tst_flush();
 
 	pid = fork();
 	if (pid < 0)
-- 
2.13.6



More information about the ltp mailing list