diff options
author | Steven Murdoch <Steven.Murdoch@cl.cam.ac.uk> | 2011-07-24 23:31:59 +0100 |
---|---|---|
committer | unknown <Steven Murdoch@.(none)> | 2011-07-25 04:08:08 +0100 |
commit | 5bf9890b3b18ad98f5ac601992bc08533ce9e209 (patch) | |
tree | 8d297ef6fa27c96b7d669fc661b4b1a6ffdea0a2 /src/common/util.c | |
parent | 99baa7e45cc65f0683912c59934679df554fa306 (diff) | |
download | tor-5bf9890b3b18ad98f5ac601992bc08533ce9e209.tar.gz tor-5bf9890b3b18ad98f5ac601992bc08533ce9e209.zip |
Test case for reading the partial output of a background process
Diffstat (limited to 'src/common/util.c')
-rw-r--r-- | src/common/util.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/common/util.c b/src/common/util.c index e63047b91e..5a5f3b5fbd 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -3292,8 +3292,8 @@ tor_get_exit_code(const process_handle_t process_handle) #ifdef MS_WINDOWS /* Windows equivalent of read_all */ -static ssize_t -read_all_handle(HANDLE h, char *buf, size_t count, HANDLE hProcess) +ssize_t +tor_read_all_handle(HANDLE h, char *buf, size_t count, HANDLE hProcess) { size_t numread = 0; BOOL retval; @@ -3310,7 +3310,7 @@ read_all_handle(HANDLE h, char *buf, size_t count, HANDLE hProcess) "Failed to peek from handle: %s", format_win32_error(GetLastError())); return -1; - } else if (0 == byte_count) + } else if (0 == byte_count) { /* Nothing available: process exited or it is busy */ /* Exit if we don't know whether the process is running */ @@ -3352,8 +3352,8 @@ tor_read_all_from_process_stdout(const process_handle_t process_handle, char *buf, size_t count) { #ifdef MS_WINDOWS - return read_all_handle(process_handle.stdout_pipe, buf, count, - process_handle.pid.hProcess); + return tor_read_all_handle(process_handle.stdout_pipe, buf, count, + process_handle.pid.hProcess); #else return read_all(process_handle.stdout_pipe, buf, count, 0); #endif @@ -3364,8 +3364,8 @@ tor_read_all_from_process_stderr(const process_handle_t process_handle, char *buf, size_t count) { #ifdef MS_WINDOWS - return read_all_handle(process_handle.stderr_pipe, buf, count, - process_handle.pid.hProcess); + return tor_read_all_handle(process_handle.stderr_pipe, buf, count, + process_handle.pid.hProcess); #else return read_all(process_handle.stderr_pipe, buf, count, 0); #endif |