From ee103ff3022c64569bbcc19f0c2fee195b07b1ce Mon Sep 17 00:00:00 2001 From: Yannick Brosseau Date: Sun, 20 Feb 2011 10:19:36 -0500 Subject: [PATCH] tests: fix tap.c use of uninitialized pipe_r_file [ Edit: updated patch header ] The _tap_comment_stdout thread can start using pipe_r_file when it is still uninitialized. Fix it by moving the initialization before the pthread creation. Signed-off-by: Yannick Brosseau Signed-off-by: Mathieu Desnoyers --- tests/tap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/tap.c b/tests/tap.c index a54fd17..4bb695e 100644 --- a/tests/tap.c +++ b/tests/tap.c @@ -58,6 +58,9 @@ static void tap_comment_stdout(void) goto close_pipe; } + /* Set it before we create the reading thread */ + setlinebuf(pipe_r_file); + stdout_fileno = fileno(stdout); if (stdout_fileno < 0) { perror("# Couldn't get fileno for stdout!?"); @@ -112,7 +115,7 @@ static void tap_comment_stdout(void) setlinebuf(stdout); setlinebuf(stderr); - setlinebuf(pipe_r_file); + return; -- 2.34.1