diff options
author | Steven Murdoch <Steven.Murdoch@cl.cam.ac.uk> | 2011-09-01 13:09:38 +0100 |
---|---|---|
committer | Steven Murdoch <Steven.Murdoch@cl.cam.ac.uk> | 2011-09-01 14:15:54 +0100 |
commit | cfa9ee5fe708539965f46a31b5d2abe4950179af (patch) | |
tree | 953e203a0834710140330a4cd6c1c4997148b10d /src/common/util.h | |
parent | a500389904c992e492db0c219e5019ed44704c29 (diff) | |
download | tor-cfa9ee5fe708539965f46a31b5d2abe4950179af.tar.gz tor-cfa9ee5fe708539965f46a31b5d2abe4950179af.zip |
Fix double-closing a stdio stream
After a stream reached eof, we fclose it, but then
test_util_spawn_background_partial_read() reads from it again, which causes
an error and thus another fclose(). Some platforms are fine with this, others
(e.g. debian-sid-i386) trigger a double-free() error. The actual code used by
Tor (log_from_pipe() and tor_check_port_forwarding()) handle this case
correctly.
Diffstat (limited to 'src/common/util.h')
-rw-r--r-- | src/common/util.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common/util.h b/src/common/util.h index 6211267d05..c8cce39f3c 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -391,7 +391,8 @@ ssize_t tor_read_all_handle(HANDLE h, char *buf, size_t count, const process_handle_t *process); #else ssize_t tor_read_all_handle(FILE *h, char *buf, size_t count, - const process_handle_t *process); + const process_handle_t *process, + int *eof); #endif ssize_t tor_read_all_from_process_stdout( const process_handle_t *process_handle, char *buf, size_t count); |