aboutsummaryrefslogtreecommitdiff
path: root/src/lib/process
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@torproject.org>2019-10-17 16:39:05 +0200
committerAlexander Færøy <ahf@torproject.org>2019-10-17 20:52:22 +0200
commit85b4a5c27659a7d162c2e476e1e0dfbeefd73095 (patch)
tree61a0828d9098b34ff909aac5365498d334bfabac /src/lib/process
parent8ac9af2330e99032445055d6728e9b3fe34a3470 (diff)
downloadtor-85b4a5c27659a7d162c2e476e1e0dfbeefd73095.tar.gz
tor-85b4a5c27659a7d162c2e476e1e0dfbeefd73095.zip
Handle errors from execve() in the Unix process backend more gracefully.
This patch removes a call to tor_assert_unreached() after execve() failed. This assertion leads to the child process emitting a stack trace on its standard output, which makes the error harder for the user to demystify, since they think it is an internal error in Tor instead of "just" being a "no such file or directory" error. The process will now instead output "Error from child process: X" where X is the stringified version of the errno value. See: https://bugs.torproject.org/31810
Diffstat (limited to 'src/lib/process')
-rw-r--r--src/lib/process/process_unix.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/lib/process/process_unix.c b/src/lib/process/process_unix.c
index 332b432c54..8191bdc1f0 100644
--- a/src/lib/process/process_unix.c
+++ b/src/lib/process/process_unix.c
@@ -253,22 +253,15 @@ process_unix_exec(process_t *process)
process_environment_t *env = process_get_environment(process);
/* Call the requested program. */
- retval = execve(argv[0], argv, env->unixoid_environment_block);
+ execve(argv[0], argv, env->unixoid_environment_block);
/* If we made it here it is because execve failed :-( */
- if (-1 == retval)
- fprintf(stderr, "Call to execve() failed: %s", strerror(errno));
-
tor_free(argv);
process_environment_free(env);
- tor_assert_unreached();
-
error:
- /* LCOV_EXCL_START */
fprintf(stderr, "Error from child process: %s", strerror(errno));
_exit(1);
- /* LCOV_EXCL_STOP */
}
/* We are in the parent process. */