Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2023-06-10 17:51:21 +0300
committerJunio C Hamano <gitster@pobox.com>2023-06-12 21:00:22 +0300
commit6d224ac286d62bb3a10c3697f220b0c10d4b5f51 (patch)
tree9b07f8b0802bc9bb87ec5ef3e30f983b13081b23 /run-command.c
parent6b6fe8b43ee71e52141ad762a38339688278f66f (diff)
run-command: report exec error even on ENOENT
If execve(2) fails with ENOENT and we report the error, we use the format "cannot run %s", followed by the actual error message. For other errors we use "cannot exec '%s'". Stop making this subtle distinction and use the second format for all execve(2) errors. This simplifies the code and makes the prefix more precise by indicating the failed operation. It also allows us to slightly simplify t1800.16. On Windows -- which lacks execve(2) -- we already use a single format in all cases: "cannot spawn %s". Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'run-command.c')
-rw-r--r--run-command.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/run-command.c b/run-command.c
index 6bd16acb06..ea192882fb 100644
--- a/run-command.c
+++ b/run-command.c
@@ -301,7 +301,6 @@ enum child_errcode {
CHILD_ERR_DUP2,
CHILD_ERR_CLOSE,
CHILD_ERR_SIGPROCMASK,
- CHILD_ERR_ENOENT,
CHILD_ERR_SILENT,
CHILD_ERR_ERRNO
};
@@ -384,9 +383,6 @@ static void child_err_spew(struct child_process *cmd, struct child_err *cerr)
case CHILD_ERR_SIGPROCMASK:
error_errno("sigprocmask failed restoring signals");
break;
- case CHILD_ERR_ENOENT:
- error_errno("cannot run %s", cmd->args.v[0]);
- break;
case CHILD_ERR_SILENT:
break;
case CHILD_ERR_ERRNO:
@@ -840,13 +836,9 @@ fail_pipe:
execve(argv.v[0], (char *const *) argv.v,
(char *const *) childenv);
- if (errno == ENOENT) {
- if (cmd->silent_exec_failure)
- child_die(CHILD_ERR_SILENT);
- child_die(CHILD_ERR_ENOENT);
- } else {
- child_die(CHILD_ERR_ERRNO);
- }
+ if (cmd->silent_exec_failure && errno == ENOENT)
+ child_die(CHILD_ERR_SILENT);
+ child_die(CHILD_ERR_ERRNO);
}
atfork_parent(&as);
if (cmd->pid < 0)