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>
This commit is contained in:
parent
35d5ae679c
commit
cf94ca8ea9
@ -352,6 +352,9 @@ int run_hook(const char *index_file, const char *name, ...)
|
|||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (access(git_path("hooks/%s", name), X_OK) < 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
va_start(args, name);
|
va_start(args, name);
|
||||||
argv[0] = git_path("hooks/%s", name);
|
argv[0] = git_path("hooks/%s", name);
|
||||||
i = 0;
|
i = 0;
|
||||||
@ -362,9 +365,6 @@ int run_hook(const char *index_file, const char *name, ...)
|
|||||||
} while (argv[i]);
|
} while (argv[i]);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
if (access(argv[0], X_OK) < 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
memset(&hook, 0, sizeof(hook));
|
memset(&hook, 0, sizeof(hook));
|
||||||
hook.argv = argv;
|
hook.argv = argv;
|
||||||
hook.no_stdin = 1;
|
hook.no_stdin = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user