put repository path into privsep children's argv
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
diff --git a/lib/object_parse.c b/lib/object_parse.c
index cffa8b7..ae0f79d 100644
--- a/lib/object_parse.c
+++ b/lib/object_parse.c
@@ -105,7 +105,7 @@ request_object(struct got_object **obj, struct got_repository *repo, int fd)
}
static void
-exec_privsep_child(int imsg_fds[2], const char *path)
+exec_privsep_child(int imsg_fds[2], const char *path, const char *repo_path)
{
close(imsg_fds[0]);
@@ -120,7 +120,7 @@ exec_privsep_child(int imsg_fds[2], const char *path)
_exit(1);
}
- if (execl(path, path, (char *)NULL) == -1) {
+ if (execl(path, path, repo_path, (char *)NULL) == -1) {
fprintf(stderr, "%s: %s: %s\n", getprogname(), path,
strerror(errno));
_exit(1);
@@ -149,7 +149,8 @@ got_object_read_header_privsep(struct got_object **obj,
if (pid == -1)
return got_error_from_errno();
else if (pid == 0) {
- exec_privsep_child(imsg_fds, GOT_PATH_PROG_READ_OBJECT);
+ exec_privsep_child(imsg_fds, GOT_PATH_PROG_READ_OBJECT,
+ repo->path);
/* not reached */
}
@@ -645,7 +646,8 @@ got_object_read_commit_privsep(struct got_commit_object **commit,
if (pid == -1)
return got_error_from_errno();
else if (pid == 0) {
- exec_privsep_child(imsg_fds, GOT_PATH_PROG_READ_COMMIT);
+ exec_privsep_child(imsg_fds, GOT_PATH_PROG_READ_COMMIT,
+ repo->path);
/* not reached */
}
@@ -697,7 +699,8 @@ got_object_read_tree_privsep(struct got_tree_object **tree,
if (pid == -1)
return got_error_from_errno();
else if (pid == 0) {
- exec_privsep_child(imsg_fds, GOT_PATH_PROG_READ_TREE);
+ exec_privsep_child(imsg_fds, GOT_PATH_PROG_READ_TREE,
+ repo->path);
/* not reached */
}
@@ -762,7 +765,8 @@ got_object_read_blob_privsep(size_t *size, int outfd, int infd,
if (pid == -1)
return got_error_from_errno();
else if (pid == 0) {
- exec_privsep_child(imsg_fds, GOT_PATH_PROG_READ_BLOB);
+ exec_privsep_child(imsg_fds, GOT_PATH_PROG_READ_BLOB,
+ repo->path);
/* not reached */
}