summaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-05-04 15:12:11 -0400
committerNick Mathewson <nickm@torproject.org>2016-05-04 15:12:11 -0400
commitb8e8910d60e41844ce4ab37d9306cb8e8b5aec91 (patch)
tree3d7089347909425cf72261e9b92c06c926c52a61 /src/common/util.c
parent31332a878db0d8f8d53fe4e535ec9ae812675315 (diff)
parentc7b9e0b8ed7076525da185e25c2142b18b4d43e3 (diff)
downloadtor-b8e8910d60e41844ce4ab37d9306cb8e8b5aec91.tar.gz
tor-b8e8910d60e41844ce4ab37d9306cb8e8b5aec91.zip
Merge branch 'bug18686_025' into maint-0.2.8
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 2351faf503..008c682b3b 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -3928,8 +3928,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)
{
@@ -3949,7 +3954,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>. */