Skip to content

Commit 33ebb87

Browse files
agericJunio C Hamano
authored andcommitted
git wrapper: fix command name in an error message.
When the command execution by execv_git_cmd() fails with an errno other than ENOENT, we used an uninitialized variable instead of the string that holds the command name to report what failed. Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 80f5074 commit 33ebb87

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

git.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ int main(int argc, const char **argv, char **envp)
206206
{
207207
const char *cmd = argv[0];
208208
char *slash = strrchr(cmd, '/');
209-
char git_command[PATH_MAX + 1];
210209
const char *exec_path = NULL;
211210
int done_alias = 0;
212211

@@ -313,7 +312,7 @@ int main(int argc, const char **argv, char **envp)
313312
cmd_usage(0, exec_path, "'%s' is not a git-command", cmd);
314313

315314
fprintf(stderr, "Failed to run command '%s': %s\n",
316-
git_command, strerror(errno));
315+
cmd, strerror(errno));
317316

318317
return 1;
319318
}

0 commit comments

Comments
 (0)