commit a251e40e110f1b745d1be771f304a7e31e2167ba from: Stefan Sperling date: Wed Mar 18 16:10:31 2020 UTC GOT_IMSG_ACK isn't needed; just fill the pipe, reading responses will block commit - fe4e150152f6808ae87ac1507402947703c40870 commit + a251e40e110f1b745d1be771f304a7e31e2167ba blob - d1b0036db1f8b8af9c1d3bc185673c5347920b19 blob + 0a308b0ba10453c978f0b5ed3d1f34c2f1234f14 --- lib/fetch.c +++ lib/fetch.c @@ -312,9 +312,6 @@ got_clone(char *uri, char *branch_filter, char *dirnam return got_error_from_errno("close"); imsg_init(&ibuf, imsg_fetchfds[0]); err = got_privsep_send_fetch_req(&ibuf, fetchfd); - if (err != NULL) - return err; - err = got_privsep_wait_ack(&ibuf); if (err != NULL) return err; err = got_privsep_send_tmpfd(&ibuf, npackfd); @@ -343,9 +340,6 @@ got_clone(char *uri, char *branch_filter, char *dirnam err = got_privsep_send_index_pack_req(&ibuf, npackfd, packhash); if (err != NULL) return err; - err = got_privsep_wait_ack(&ibuf); - if (err != NULL) - return err; err = got_privsep_send_tmpfd(&ibuf, nidxfd); if (err != NULL) return err; blob - 0c4a043a653118f69c831430705349acaca9bd80 blob + 12c2aa8b4562b5dd11c9ca5b15c97f9a982ae80a --- lib/got_lib_privsep.h +++ lib/got_lib_privsep.h @@ -85,9 +85,6 @@ enum got_imsg_type { /* Stop the child process. */ GOT_IMSG_STOP, - /* We got a message as part of a sequence */ - GOT_IMSG_ACK, - /* * Messages concerned with read access to objects in a repository. * Object and pack files are opened by the main process, where blob - b5ea8d20c9397777b036e28835ffe9f983563ddd blob + 90f056a189e8a0d3cc60f7f8c9c99c95e89c2053 --- lib/privsep.c +++ lib/privsep.c @@ -231,31 +231,6 @@ got_privsep_send_stop(int fd) } const struct got_error * -got_privsep_send_ack(struct imsgbuf *ibuf) -{ - if (imsg_compose(ibuf, GOT_IMSG_ACK, 0, 0, -1, NULL, 0) == -1) - return got_error_from_errno("imsg_compose ACK"); - return flush_imsg(ibuf); -} - -const struct got_error * -got_privsep_wait_ack(struct imsgbuf *ibuf) -{ - const struct got_error *err = NULL; - struct imsg imsg; - - err = got_privsep_recv_imsg(&imsg, ibuf, 0); - if (err) - return err; - if (imsg.hdr.type == GOT_IMSG_ACK && imsg.hdr.len - IMSG_HEADER_SIZE == 0) - return NULL; - else - return got_error(GOT_ERR_PRIVSEP_MSG); - imsg_free(&imsg); -} - - -const struct got_error * got_privsep_send_obj_req(struct imsgbuf *ibuf, int fd) { if (imsg_compose(ibuf, GOT_IMSG_OBJECT_REQUEST, 0, 0, fd, NULL, 0) blob - 8d9608005fc74a2d524f92b5d221a03d4f1992d9 blob + f47aa8e86d8768912715b400cf78789fd66db0b8 --- libexec/got-fetch-pack/got-fetch-pack.c +++ libexec/got-fetch-pack/got-fetch-pack.c @@ -429,7 +429,6 @@ main(int argc, char **argv) goto done; } fetchfd = imsg.fd; - got_privsep_send_ack(&ibuf); if((err = got_privsep_recv_imsg(&imsg, &ibuf, 0)) != 0) { if (err->code == GOT_ERR_PRIVSEP_PIPE) blob - c000f2cb994a50009b3495de8cf361532742b517 blob + cd6e4f449903bc09a611098583a07691ac6e59f8 --- libexec/got-index-pack/got-index-pack.c +++ libexec/got-index-pack/got-index-pack.c @@ -1236,7 +1236,6 @@ main(int argc, char **argv) } packfd = imsg.fd; memcpy(packhash.sha1, imsg.data, SHA1_DIGEST_LENGTH); - got_privsep_send_ack(&ibuf); if((err = got_privsep_recv_imsg(&imsg, &ibuf, 0)) != 0) { if (err->code == GOT_ERR_PRIVSEP_PIPE)