From: Yannick Brosseau Date: Sun, 20 Feb 2011 15:19:36 +0000 (-0500) Subject: tests: fix tap.c use of uninitialized pipe_r_file X-Git-Tag: v0.12~44 X-Git-Url: http://git.lttng.org/?p=ust.git;a=commitdiff_plain;h=ee103ff3022c64569bbcc19f0c2fee195b07b1ce 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 --- 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;