summaryrefslogtreecommitdiff
path: root/run-command.c
diff options
context:
space:
mode:
authorStephan Beyer <s-beyer@gmx.net>2009-01-16 20:10:01 +0100
committerJunio C Hamano <gitster@pobox.com>2009-01-17 17:16:44 -0800
commitcf94ca8ea98373d6f5e9caaa764eca89b20bfb63 (patch)
tree9e6b953e3458c4a50d0b5cb184af4486f3ab7a55 /run-command.c
parent35d5ae679c2a6bc2a5f70f9209844ae8c14ae9e3 (diff)
downloadgit-cf94ca8ea98373d6f5e9caaa764eca89b20bfb63.tar.gz
run_hook(): check the executability of the hook before filling argv
Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'run-command.c')
-rw-r--r--run-command.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/run-command.c b/run-command.c
index 49810a835e..fc54c07a93 100644
--- a/run-command.c
+++ b/run-command.c
@@ -352,6 +352,9 @@ int run_hook(const char *index_file, const char *name, ...)
int ret;
int i;
+ if (access(git_path("hooks/%s", name), X_OK) < 0)
+ return 0;
+
va_start(args, name);
argv[0] = git_path("hooks/%s", name);
i = 0;
@@ -362,9 +365,6 @@ int run_hook(const char *index_file, const char *name, ...)
} while (argv[i]);
va_end(args);
- if (access(argv[0], X_OK) < 0)
- return 0;
-
memset(&hook, 0, sizeof(hook));
hook.argv = argv;
hook.no_stdin = 1;