aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-08-09 10:55:30 -0400
committerNick Mathewson <nickm@torproject.org>2017-08-09 10:58:07 -0400
commitb4963da987f0b374a2bbfd866e1a36358b1e750f (patch)
tree142e23ff78f2efa0663f4f4f64792c8a7be1d391 /src/common/util.c
parent5fa8d05bfa17d61a2cf96c87f0ffd9a2b6e577d2 (diff)
downloadtor-b4963da987f0b374a2bbfd866e1a36358b1e750f.tar.gz
tor-b4963da987f0b374a2bbfd866e1a36358b1e750f.zip
Treat a bad tor_spawn_background() as a BUG().
The contract is that, if may_spawn_background_process() is 0, you're not even allowed to try to spawn a process.
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 18108fc242..eff678d6a4 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -4180,8 +4180,11 @@ tor_spawn_background(const char *const filename, const char **argv,
process_environment_t *env,
process_handle_t **process_handle_out)
{
- if (may_spawn_background_process == 0)
+ if (BUG(may_spawn_background_process == 0)) {
+ /* We should never reach this point if we're forbidden to spawn
+ * processes. Instead we should have caught the attempt earlier. */
return PROCESS_STATUS_ERROR;
+ }
#ifdef _WIN32
HANDLE stdout_pipe_read = NULL;