commit bbca1adf04e40d91b98c326953a147a37b94c817 from: Omar Polo date: Tue Jan 30 11:31:28 2024 UTC remove unneded wbuf->fd = -1 There's no need to set the fd to -1 on ibufs created with imsg_create(3), and it was probably never needed. commit - 2c52c623be04b56400a5c94cc8d86b6fda214d16 commit + bbca1adf04e40d91b98c326953a147a37b94c817 blob - d68ef57610af2d102688f0961076da441add53d7 blob + 8dfa9ac368e4140a0ffd66fbb7761f6ef2ce5b40 --- gotd/repo_read.c +++ gotd/repo_read.c @@ -141,7 +141,6 @@ send_symref(struct got_reference *symref, struct got_o goto done; } - wbuf->fd = -1; imsg_close(ibuf, wbuf); done: free(target_id); @@ -198,7 +197,6 @@ send_peeled_tag_ref(struct got_reference *ref, struct goto done; } - wbuf->fd = -1; imsg_close(ibuf, wbuf); done: got_object_tag_close(tag); @@ -241,7 +239,6 @@ send_ref(struct got_reference *ref, struct imsgbuf *ib if (imsg_add(wbuf, refname, namelen) == -1) return got_error_from_errno("imsg_add REF"); - wbuf->fd = -1; imsg_close(ibuf, wbuf); err = got_object_open(&obj, repo_read.repo, id); blob - 780677ae9232bbcf5aee0de51f94c9105efe7a72 blob + ed6de8db29817b25f285cd13c8395a03bfa2e2aa --- gotd/repo_write.c +++ gotd/repo_write.c @@ -174,7 +174,6 @@ send_peeled_tag_ref(struct got_reference *ref, struct goto done; } - wbuf->fd = -1; imsg_close(ibuf, wbuf); done: got_object_tag_close(tag); @@ -217,7 +216,6 @@ send_ref(struct got_reference *ref, struct imsgbuf *ib if (imsg_add(wbuf, refname, namelen) == -1) return got_error_from_errno("imsg_add REF"); - wbuf->fd = -1; imsg_close(ibuf, wbuf); err = got_object_open(&obj, repo_write.repo, id); @@ -1185,7 +1183,6 @@ report_pack_status(const struct got_error *unpack_err) goto done; } - wbuf->fd = -1; imsg_close(&ibuf, wbuf); err = gotd_imsg_flush(&ibuf); @@ -1558,7 +1555,6 @@ send_ref_update(struct gotd_ref_update *ref_update, st if (imsg_add(wbuf, refname, iref.name_len) == -1) return got_error_from_errno("imsg_add REF_UPDATE"); - wbuf->fd = -1; imsg_close(&iev->ibuf, wbuf); gotd_imsg_event_add(iev); blob - 6e0018108f6f7c5dabd6f13ff0adde909c3e9e8f blob + 402b1ccfef8728b954ba0339814fdc2e1b9c7ba4 --- gotd/session.c +++ gotd/session.c @@ -263,7 +263,6 @@ send_ref_update_ok(struct gotd_session_client *client, if (imsg_add(wbuf, refname, iok.name_len) == -1) return got_error_from_errno("imsg_add REF_UPDATE_OK"); - wbuf->fd = -1; imsg_close(&iev->ibuf, wbuf); gotd_imsg_event_add(iev); return NULL; @@ -310,7 +309,6 @@ send_ref_update_ng(struct gotd_session_client *client, if (imsg_add(wbuf, ng_err->msg, ing.reason_len) == -1) return got_error_from_errno("imsg_add REF_UPDATE_NG"); - wbuf->fd = -1; imsg_close(&iev->ibuf, wbuf); gotd_imsg_event_add(iev); return NULL; blob - 843fa5982aee9be13ae1370c9db781d173b43021 blob + 16d6eeece5252ed4c35915742908b5fda451090d --- lib/serve.c +++ lib/serve.c @@ -408,7 +408,6 @@ send_capability(struct got_capability *capa, struct im return got_error_from_errno("imsg_add CAPABILITY"); } - wbuf->fd = -1; imsg_close(ibuf, wbuf); return NULL; @@ -1026,7 +1025,6 @@ recv_ref_update(int *report_status, int outfd, struct return got_error_from_errno("imsg_add REF_UPDATE"); if (imsg_add(wbuf, refname, iref.name_len) == -1) return got_error_from_errno("imsg_add REF_UPDATE"); - wbuf->fd = -1; imsg_close(ibuf, wbuf); err = gotd_imsg_flush(ibuf); blob - 00fd3248748839d85a7ffa90d9f8b8113b49b4f9 blob + 4e20977276b1e47ce59ae8184bdc6c63ad1cab08 --- libexec/got-fetch-pack/got-fetch-pack.c +++ libexec/got-fetch-pack/got-fetch-pack.c @@ -261,7 +261,6 @@ send_fetch_symrefs(struct imsgbuf *ibuf, struct got_pa return got_error_from_errno("imsg_add FETCH_SYMREFS"); } - wbuf->fd = -1; imsg_close(ibuf, wbuf); return got_privsep_flush_imsg(ibuf); } @@ -287,7 +286,6 @@ send_fetch_ref(struct imsgbuf *ibuf, struct got_object if (imsg_add(wbuf, refname, reflen) == -1) return got_error_from_errno("imsg_add FETCH_REF"); - wbuf->fd = -1; imsg_close(ibuf, wbuf); return got_privsep_flush_imsg(ibuf); } blob - 83c6c390aa8e24bc88e8e20d346d2ec34dc5a0c2 blob + 9a5bac7eae6301e9090148ee2ec8d0dbdaf69237 --- libexec/got-read-gitconfig/got-read-gitconfig.c +++ libexec/got-read-gitconfig/got-read-gitconfig.c @@ -108,7 +108,6 @@ send_gitconfig_pair(struct imsgbuf *ibuf, const char * if (imsg_add(wbuf, val, vlen) == -1) return got_error_from_errno("imsg_add GITCONFIG_PAIR"); - wbuf->fd = -1; imsg_close(ibuf, wbuf); return got_privsep_flush_imsg(ibuf); } @@ -176,7 +175,6 @@ send_gitconfig_remotes(struct imsgbuf *ibuf, struct go return got_error_from_errno( "imsg_add GITCONFIG_REMOTE"); - wbuf->fd = -1; imsg_close(ibuf, wbuf); err = got_privsep_flush_imsg(ibuf); if (err) blob - cc9c5eceb4d4b6f891f43c7228043d26893782bf blob + ffe9a941778281ee217eec2e4ad1c0974ccf4015 --- libexec/got-read-gotconfig/got-read-gotconfig.c +++ libexec/got-read-gotconfig/got-read-gotconfig.c @@ -330,7 +330,6 @@ send_gotconfig_remotes(struct imsgbuf *ibuf, break; } - wbuf->fd = -1; imsg_close(ibuf, wbuf); err = got_privsep_flush_imsg(ibuf); if (err) blob - 2105026a81511417fce4297207c3af3298d8f1de blob + 1a3634ab2fe9a44827da4a6597ff3582c37a42f3 --- libexec/got-read-pack/got-read-pack.c +++ libexec/got-read-pack/got-read-pack.c @@ -617,7 +617,6 @@ send_traversed_commits(struct got_object_id *commit_id } } - wbuf->fd = -1; imsg_close(ibuf, wbuf); return got_privsep_flush_imsg(ibuf); blob - 64baada11e1ccee7903385f01a1dd207eb53ddd4 blob + dc7a261465f7dbccf70213d2cc4f78255d7ea53a --- libexec/got-send-pack/got-send-pack.c +++ libexec/got-send-pack/got-send-pack.c @@ -214,7 +214,6 @@ send_their_ref(struct imsgbuf *ibuf, struct got_object if (imsg_add(wbuf, refname, reflen) == -1) return got_error_from_errno("imsg_add SEND_REMOTE_REF"); - wbuf->fd = -1; imsg_close(ibuf, wbuf); return got_privsep_flush_imsg(ibuf); } @@ -298,7 +297,6 @@ send_ref_status(struct imsgbuf *ibuf, const char *refn if (imsg_add(wbuf, errmsg, errmsglen) == -1) return got_error_from_errno("imsg_add SEND_REF_STATUS"); - wbuf->fd = -1; imsg_close(ibuf, wbuf); return got_privsep_flush_imsg(ibuf); }