use a dedicated imsg for sending the pack fetch output file descriptor
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 63 64
diff --git a/lib/fetch.c b/lib/fetch.c
index 0a0cc26..db72516 100644
--- a/lib/fetch.c
+++ b/lib/fetch.c
@@ -419,7 +419,7 @@ got_fetch_pack(struct got_object_id **pack_hash, struct got_pathlist_head *refs,
if (err != NULL)
goto done;
nfetchfd = -1;
- err = got_privsep_send_tmpfd(&fetchibuf, npackfd);
+ err = got_privsep_send_fetch_outfd(&fetchibuf, npackfd);
if (err != NULL)
goto done;
npackfd = dup(packfd);
diff --git a/lib/got_lib_privsep.h b/lib/got_lib_privsep.h
index 0e76d54..060d60c 100644
--- a/lib/got_lib_privsep.h
+++ b/lib/got_lib_privsep.h
@@ -110,6 +110,7 @@ enum got_imsg_type {
/* Messages related to networking. */
GOT_IMSG_FETCH_REQUEST,
+ GOT_IMSG_FETCH_OUTFD,
GOT_IMSG_FETCH_SYMREFS,
GOT_IMSG_FETCH_REF,
GOT_IMSG_FETCH_SERVER_PROGRESS,
@@ -387,6 +388,7 @@ const struct got_error *got_privsep_recv_index_progress(int *, int *, int *,
int *, int *, struct imsgbuf *ibuf);
const struct got_error *got_privsep_send_fetch_req(struct imsgbuf *, int,
struct got_pathlist_head *);
+const struct got_error *got_privsep_send_fetch_outfd(struct imsgbuf *, int);
const struct got_error *got_privsep_send_fetch_symrefs(struct imsgbuf *,
struct got_pathlist_head *);
const struct got_error *got_privsep_send_fetch_ref(struct imsgbuf *,
diff --git a/lib/privsep.c b/lib/privsep.c
index 938c697..d271eda 100644
--- a/lib/privsep.c
+++ b/lib/privsep.c
@@ -477,6 +477,13 @@ got_privsep_send_fetch_req(struct imsgbuf *ibuf, int fd,
}
const struct got_error *
+got_privsep_send_fetch_outfd(struct imsgbuf *ibuf, int fd)
+{
+ return send_fd(ibuf, GOT_IMSG_FETCH_OUTFD, fd);
+}
+
+
+const struct got_error *
got_privsep_send_fetch_symrefs(struct imsgbuf *ibuf,
struct got_pathlist_head *symrefs)
{
diff --git a/libexec/got-fetch-pack/got-fetch-pack.c b/libexec/got-fetch-pack/got-fetch-pack.c
index 913393e..d86b89f 100644
--- a/libexec/got-fetch-pack/got-fetch-pack.c
+++ b/libexec/got-fetch-pack/got-fetch-pack.c
@@ -793,7 +793,7 @@ main(int argc, char **argv)
}
if (imsg.hdr.type == GOT_IMSG_STOP)
goto done;
- if (imsg.hdr.type != GOT_IMSG_TMPFD) {
+ if (imsg.hdr.type != GOT_IMSG_FETCH_OUTFD) {
err = got_error(GOT_ERR_PRIVSEP_MSG);
goto done;
}