diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-05-04 23:32:18 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-05-04 23:32:18 -0400 |
commit | d8cb4f9f0ce075daf4469db18218901f3a720282 (patch) | |
tree | 92369d15bd03b35b63a675fd77b353001c7369e0 /src/test | |
parent | 08efa70c41b258d8655ec01bdb721aea96b42d46 (diff) | |
download | tor-d8cb4f9f0ce075daf4469db18218901f3a720282.tar.gz tor-d8cb4f9f0ce075daf4469db18218901f3a720282.zip |
Use read_all() to read messages from spawn_background
Using read() is an invitation to get some of the data you want, not all.
Possible fix for bug 2462
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_util.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index 25fd51c124..efbc47b460 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -1367,7 +1367,7 @@ run_util_spawn_background(const char *argv[], const char *expected_out, pid = retval; /* Check stdout */ - pos = read(stdout_pipe, stdout_buf, sizeof(stdout_buf) - 1); + pos = read_all(stdout_pipe, stdout_buf, sizeof(stdout_buf) - 1, 0); stdout_buf[pos] = '\0'; tt_int_op(pos, ==, strlen(expected_out)); tt_str_op(stdout_buf, ==, expected_out); @@ -1381,7 +1381,7 @@ run_util_spawn_background(const char *argv[], const char *expected_out, tt_assert(!WIFSTOPPED(stat_loc)); /* Check stderr */ - pos = read(stderr_pipe, stderr_buf, sizeof(stderr_buf) - 1); + pos = read_all(stderr_pipe, stderr_buf, sizeof(stderr_buf) - 1, 0); stderr_buf[pos] = '\0'; tt_int_op(pos, ==, strlen(expected_err)); tt_str_op(stderr_buf, ==, expected_err); |