diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-08-01 10:15:44 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-08-01 11:01:52 -0400 |
commit | 9a89450b6d1734fb8e015093353a5d0568b41b79 (patch) | |
tree | 0d1ea9530dc51c449cb40af0dc59df757c73a7c6 /src/tools | |
parent | ff7229b32cb2f5a3c384200caac35e0626199087 (diff) | |
download | tor-9a89450b6d1734fb8e015093353a5d0568b41b79.tar.gz tor-9a89450b6d1734fb8e015093353a5d0568b41b79.zip |
tor_api: Extend tor_api code so it can pass extra arguments to main.
We need this so that the tor_api user can specify some arguments,
while the tor_api implementation adds others.
This implementation detail should not be visible to tor_api users.
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/tor_runner.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/tools/tor_runner.c b/src/tools/tor_runner.c index dd90af3df5..4b21d7bf9b 100644 --- a/src/tools/tor_runner.c +++ b/src/tools/tor_runner.c @@ -86,9 +86,13 @@ child(const tor_main_configuration_t *cfg) { /* XXXX Close unused file descriptors. */ - char **args = real_calloc(cfg->argc+1, sizeof(char *)); + char **args = real_calloc(cfg->argc + cfg->argc_owned+1, sizeof(char *)); memcpy(args, cfg->argv, cfg->argc * sizeof(char *)); - args[cfg->argc] = NULL; + if (cfg->argc_owned) + memcpy(args + cfg->argc, cfg->argv_owned, + cfg->argc_owned * sizeof(char *)); + + args[cfg->argc + cfg->argc_owned] = NULL; int rv = execv(BINDIR "/tor", args); @@ -98,4 +102,3 @@ child(const tor_main_configuration_t *cfg) abort(); /* Unreachable */ } } - |