commit 2efafdfe14411b800e9350e527955ca74f3c704b Author: Steven Murdoch Steven.Murdoch@cl.cam.ac.uk Date: Tue Aug 23 01:09:24 2011 +0100
Fix compilation errors under *nix --- src/common/util.c | 9 ++++++--- src/common/util.h | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/common/util.c b/src/common/util.c index 36b5966..f25dd43 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -3071,6 +3071,7 @@ tor_spawn_background(const char *const filename, const char **argv) saAttr.lpSecurityDescriptor = NULL;
/* Assume failure to start process */ + memset(&process_handle, 0, sizeof(process_handle)); process_handle.status = -1;
/* Set up pipe for stdout */ @@ -3167,6 +3168,7 @@ tor_spawn_background(const char *const filename, const char **argv) static int max_fd = -1;
/* Assume failure to start */ + memset(&process_handle, 0, sizeof(process_handle)); process_handle.status = -1;
/* We do the strlen here because strlen() is not signal handler safe, @@ -3374,8 +3376,6 @@ tor_get_exit_code(const process_handle_t process_handle, return -1; } } - - return 0; #else int stat_loc; int retval; @@ -3398,6 +3398,8 @@ tor_get_exit_code(const process_handle_t process_handle, if (exit_code != NULL) *exit_code = WEXITSTATUS(stat_loc); #endif // MS_WINDOWS + + return 0; }
#ifdef MS_WINDOWS @@ -3667,7 +3669,8 @@ tor_check_port_forwarding(const char *filename, int dir_port, int or_port, "Started port forwarding helper (%s)", filename); #else log_info(LD_GENERAL, - "Started port forwarding helper (%s) with pid %d", filename, child_pid); + "Started port forwarding helper (%s) with pid %d", filename, + child_handle.pid); #endif }
diff --git a/src/common/util.h b/src/common/util.h index 9022334..b4ae3f8 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -374,7 +374,9 @@ process_handle_t tor_spawn_background(const char *const filename, const char **argv); int tor_get_exit_code(const process_handle_t process_handle, int block, int *exit_code); +#ifdef MS_WINDOWS ssize_t tor_read_all_handle(HANDLE h, char *buf, size_t count, HANDLE hProcess); +#endif ssize_t tor_read_all_from_process_stdout(const process_handle_t process_handle, char *buf, size_t count); ssize_t tor_read_all_from_process_stderr(const process_handle_t process_handle,