path: root/run-command.h
diff options
authorNguyễn Thái Ngọc Duy <>2014-11-30 08:24:27 (GMT)
committerJunio C Hamano <>2014-12-01 19:00:10 (GMT)
commitdcf692625ac569fefbe52269061230f4fde10e47 (patch)
treea56beac7a3de4c6bd8557288f802fc28738b52a4 /run-command.h
parent4ef9caf5431dbbd23f240a25b69a989aeb9840a4 (diff)
path.c: make get_pathname() call sites return const char *
Before the previous commit, get_pathname returns an array of PATH_MAX length. Even if git_path() and similar functions does not use the whole array, git_path() caller can, in theory. After the commit, get_pathname() may return a buffer that has just enough room for the returned string and git_path() caller should never write beyond that. Make git_path(), mkpath() and git_path_submodule() return a const buffer to make sure callers do not write in it at all. This could have been part of the previous commit, but the "const" conversion is too much distraction from the core changes in path.c. Signed-off-by: Nguyễn Thái Ngọc Duy <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'run-command.h')
1 files changed, 1 insertions, 1 deletions
diff --git a/run-command.h b/run-command.h
index 2137315..892892d 100644
--- a/run-command.h
+++ b/run-command.h
@@ -52,7 +52,7 @@ int start_command(struct child_process *);
int finish_command(struct child_process *);
int run_command(struct child_process *);
-extern char *find_hook(const char *name);
+extern const char *find_hook(const char *name);
extern int run_hook_le(const char *const *env, const char *name, ...);
extern int run_hook_ve(const char *const *env, const char *name, va_list args);