diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-05-04 15:10:36 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-05-04 15:10:36 -0400 |
commit | c7b9e0b8ed7076525da185e25c2142b18b4d43e3 (patch) | |
tree | d2f1429670f6b7f28b0765deb73d876e5ae18593 /src/common | |
parent | 34a51d162153f12d34f2445c6efa72dc4f6ddcd8 (diff) | |
download | tor-c7b9e0b8ed7076525da185e25c2142b18b4d43e3.tar.gz tor-c7b9e0b8ed7076525da185e25c2142b18b4d43e3.zip |
Report success when not terminating an already terminated process.
Also, document the actual behavior and return values of
tor_terminate_process.
Fixes bug18686; bugfix on 0.2.3.9-alpha.
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/util.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/common/util.c b/src/common/util.c index 04cc6b12c6..65af8a672a 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -3626,8 +3626,13 @@ format_helper_exit_status(unsigned char child_state, int saved_errno, /* Maximum number of file descriptors, if we cannot get it via sysconf() */ #define DEFAULT_MAX_FD 256 -/** Terminate the process of <b>process_handle</b>. - * Code borrowed from Python's os.kill. */ +/** Terminate the process of <b>process_handle</b>, if that process has not + * already exited. + * + * Return 0 if we succeeded in terminating the process (or if the process + * already exited), and -1 if we tried to kill the process but failed. + * + * Based on code originally borrowed from Python's os.kill. */ int tor_terminate_process(process_handle_t *process_handle) { @@ -3647,7 +3652,7 @@ tor_terminate_process(process_handle_t *process_handle) } #endif - return -1; + return 0; /* We didn't need to kill the process, so report success */ } /** Return the Process ID of <b>process_handle</b>. */ |