mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
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
This commit is contained in:
parent
e483257e1b
commit
9915b8f0bc
4
changes/bug31810
Normal file
4
changes/bug31810
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
o Minor bugfixes (process management):
|
||||||
|
- Remove assertion in the Unix process backend. This assertion would trigger
|
||||||
|
when a new process is spawned where the executable is not found leading to
|
||||||
|
a stack trace from the child process. Fixes bug 31810; bugfix on 0.4.0.1-alpha.
|
@ -253,22 +253,15 @@ process_unix_exec(process_t *process)
|
|||||||
process_environment_t *env = process_get_environment(process);
|
process_environment_t *env = process_get_environment(process);
|
||||||
|
|
||||||
/* Call the requested program. */
|
/* 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 we made it here it is because execve failed :-( */
|
||||||
if (-1 == retval)
|
|
||||||
fprintf(stderr, "Call to execve() failed: %s", strerror(errno));
|
|
||||||
|
|
||||||
tor_free(argv);
|
tor_free(argv);
|
||||||
process_environment_free(env);
|
process_environment_free(env);
|
||||||
|
|
||||||
tor_assert_unreached();
|
|
||||||
|
|
||||||
error:
|
error:
|
||||||
/* LCOV_EXCL_START */
|
|
||||||
fprintf(stderr, "Error from child process: %s", strerror(errno));
|
fprintf(stderr, "Error from child process: %s", strerror(errno));
|
||||||
_exit(1);
|
_exit(1);
|
||||||
/* LCOV_EXCL_STOP */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We are in the parent process. */
|
/* We are in the parent process. */
|
||||||
|
Loading…
Reference in New Issue
Block a user