[PATCH 2/2] Remember and use GIT_EXEC_PATH on exec()'s
From: Michal Ostrowski <hidden>
Date: 2016-06-15 22:42:16
Subsystem:
the rest · Maintainer:
Linus Torvalds
Calls to git_setup_exec_path() are inserted on paths that will execute other git programs. git_setup_exec_path() will ensure that the git installation directories are in the path. Signed-off-by: Michal Ostrowski <redacted> --- daemon.c | 2 ++ fetch-clone.c | 2 ++ run-command.c | 1 + send-pack.c | 2 ++ upload-pack.c | 4 +++- 5 files changed, 10 insertions(+), 1 deletions(-) bb14b4b61f53f755486695e5bdc45b5623a6f8c5
diff --git a/daemon.c b/daemon.c
index 3bd1426..d653f33 100644
--- a/daemon.c
+++ b/daemon.c@@ -226,6 +226,8 @@ static int upload(char *dir) snprintf(timeout_buf, sizeof timeout_buf, "--timeout=%u", timeout); + git_setup_exec_path(); + /* git-upload-pack only ever reads stuff, so this is safe */ execlp("git-upload-pack", "git-upload-pack", "--strict", timeout_buf,
".", NULL); return -1;
diff --git a/fetch-clone.c b/fetch-clone.c
index f46fe6e..afbbb79 100644
--- a/fetch-clone.c
+++ b/fetch-clone.c@@ -98,6 +98,8 @@ int receive_unpack_pack(int fd[2], const int status; pid_t pid; + git_setup_exec_path(); + pid = fork(); if (pid < 0) die("%s: unable to fork off git-unpack-objects", me);
diff --git a/run-command.c b/run-command.c
index 8bf5922..993a3f9 100644
--- a/run-command.c
+++ b/run-command.c@@ -9,6 +9,7 @@ int run_command_v_opt(int argc, char **a if (pid < 0) return -ERR_RUN_COMMAND_FORK; if (!pid) { + git_setup_exec_path(); if (flags & RUN_COMMAND_NO_STDIO) { int fd = open("/dev/null", O_RDWR); dup2(fd, 0);
diff --git a/send-pack.c b/send-pack.c
index cd36193..a241f00 100644
--- a/send-pack.c
+++ b/send-pack.c@@ -30,6 +30,7 @@ static void exec_pack_objects(void) "--stdout", NULL }; + git_setup_exec_path(); execvp("git-pack-objects", args); die("git-pack-objects exec failed (%s)", strerror(errno)); }
@@ -58,6 +59,7 @@ static void exec_rev_list(struct ref *re refs = refs->next; } args[i] = NULL; + git_setup_exec_path(); execvp("git-rev-list", args); die("git-rev-list exec failed (%s)", strerror(errno)); }
diff --git a/upload-pack.c b/upload-pack.c
index 1834b6b..f8d4fbe 100644
--- a/upload-pack.c
+++ b/upload-pack.c@@ -270,7 +270,9 @@ int main(int argc, char **argv) break; } } - + + git_setup_exec_path(); + if (i != argc-1) usage(upload_pack_usage); dir = argv[i];
--
0.99.9m-g02ad