]> git.lttng.org Git - ust.git/commitdiff
tests: fix tap.c use of uninitialized pipe_r_file
authorYannick Brosseau <yannick.brosseau@gmail.com>
Sun, 20 Feb 2011 15:19:36 +0000 (10:19 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Sun, 20 Feb 2011 15:19:36 +0000 (10:19 -0500)
[ 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 <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests/tap.c

index a54fd178d12f96cf9a32ac591754526c4149e4b4..4bb695ef4ebcccd6a1bd26182b46e28aa394c7a5 100644 (file)
@@ -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;
 
This page took 0.028745 seconds and 4 git commands to generate.