commit 04ddbc75ae91738a071c04bb2f2d6c9ff4dac225 from: Omar Polo via: Thomas Adam date: Wed Jan 31 22:01:32 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 - 3d97effaa4fe16c79f725bf260f06220e62e5c6a commit + 04ddbc75ae91738a071c04bb2f2d6c9ff4dac225 blob - 5860623235693f75c4c5c3dae27ad355ee084be1 blob + 6ed6c8dc27efd3a85d31e6885b8eefb2e80b06e5 --- 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 - 75d16b4a52946182333abe8cc658752b4842b7d3 blob + bc9ef0d64141e9df96d93d992d4b70ec9ccf4f2f --- gotd/repo_write.c +++ gotd/repo_write.c @@ -172,7 +172,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); @@ -215,7 +214,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); @@ -1183,7 +1181,6 @@ report_pack_status(const struct got_error *unpack_err) goto done; } - wbuf->fd = -1; imsg_close(&ibuf, wbuf); err = gotd_imsg_flush(&ibuf); @@ -1556,7 +1553,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 - b4c8a49f654b65665982670d9b56b7314a10efd5 blob + 267e7ef666d0878c08135b645d1a918e641ad989 --- gotd/session.c +++ gotd/session.c @@ -264,7 +264,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; @@ -311,7 +310,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 - efc694b36944f601e4a9ce7d58e37865850e5689 blob + 814c595c9b1c1b5528734c41bf8c2c13365cabdc --- 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 - c85fb402c902f5fda8a01743ae051712444ced6e blob + a76d4ffce3d5b5ebcf828a8dc15495bedb7d3b44 --- libexec/got-fetch-pack/got-fetch-pack.c +++ libexec/got-fetch-pack/got-fetch-pack.c @@ -260,7 +260,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); } @@ -286,7 +285,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 - 6c8b57b3facca5b9dcc832edc6f66a039c44c654 blob + 238ffc0a0a9f2ede4fa29f96b303779d22af87a4 --- libexec/got-read-gitconfig/got-read-gitconfig.c +++ libexec/got-read-gitconfig/got-read-gitconfig.c @@ -107,7 +107,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); } @@ -175,7 +174,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 - 56d436f414c7ef9f23bd78db1d42297ca021c18a blob + 4a11620d84aa87c18fc5333e6c9cd1930310b2ab --- libexec/got-read-gotconfig/got-read-gotconfig.c +++ libexec/got-read-gotconfig/got-read-gotconfig.c @@ -329,7 +329,6 @@ send_gotconfig_remotes(struct imsgbuf *ibuf, break; } - wbuf->fd = -1; imsg_close(ibuf, wbuf); err = got_privsep_flush_imsg(ibuf); if (err) blob - 00bb589bc2faa0903e3a4664d5d35bf948fa0aec blob + 06f57d753ec1f05f981eef86054a3c713effa91b --- libexec/got-read-pack/got-read-pack.c +++ libexec/got-read-pack/got-read-pack.c @@ -615,7 +615,6 @@ send_traversed_commits(struct got_object_id *commit_id } } - wbuf->fd = -1; imsg_close(ibuf, wbuf); return got_privsep_flush_imsg(ibuf); blob - 76552a0cd46c0a952c443ddca495e8d107d49fde blob + 7b40464990e4153f3a1019f63dfda9cf5ba69855 --- libexec/got-send-pack/got-send-pack.c +++ libexec/got-send-pack/got-send-pack.c @@ -212,7 +212,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); } @@ -296,7 +295,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); }