commit ac4f092c7c8e090ee733c90b8b0f0274872c8662 from: Omar Polo date: Fri Nov 03 14:41:25 2023 UTC don't redundantly set wbuf->fd to -1 ibuf_dynamic() (called by imsg_create()) already initializes fd to -1. commit - 2161bc24065b9b58f71cbffbb8b65a9546e134f2 commit + ac4f092c7c8e090ee733c90b8b0f0274872c8662 blob - 60f06c7355f84cc81697802f90406ad3939a5071 blob + 7d479df74800ae6ac1809d68db5f4d54482efd23 --- lib/privsep.c +++ lib/privsep.c @@ -293,9 +293,7 @@ got_privsep_send_raw_obj(struct imsgbuf *ibuf, off_t s return got_error_from_errno("imsg_add RAW_OBJECT"); } - wbuf->fd = -1; imsg_close(ibuf, wbuf); - return flush_imsg(ibuf); } @@ -640,7 +638,6 @@ got_privsep_send_fetch_req(struct imsgbuf *ibuf, int f if (imsg_add(wbuf, name, name_len) == -1) return got_error_from_errno("imsg_add FETCH_HAVE_REF"); - wbuf->fd = -1; imsg_close(ibuf, wbuf); err = flush_imsg(ibuf); if (err) @@ -666,7 +663,6 @@ got_privsep_send_fetch_req(struct imsgbuf *ibuf, int f return got_error_from_errno( "imsg_add FETCH_WANTED_BRANCH"); - wbuf->fd = -1; imsg_close(ibuf, wbuf); err = flush_imsg(ibuf); if (err) @@ -692,7 +688,6 @@ got_privsep_send_fetch_req(struct imsgbuf *ibuf, int f return got_error_from_errno( "imsg_add FETCH_WANTED_REF"); - wbuf->fd = -1; imsg_close(ibuf, wbuf); err = flush_imsg(ibuf); if (err) @@ -878,7 +873,6 @@ send_send_ref(const char *name, size_t name_len, struc if (imsg_add(wbuf, name, name_len) == -1) return got_error_from_errno("imsg_add SEND_REF"); - wbuf->fd = -1; imsg_close(ibuf, wbuf); return flush_imsg(ibuf); } @@ -1471,7 +1465,6 @@ send_tree_entries_batch(struct imsgbuf *ibuf, return got_error_from_errno("imsg_add TREE_ENTRY"); } - wbuf->fd = -1; imsg_close(ibuf, wbuf); return NULL; } @@ -2698,9 +2691,7 @@ got_privsep_send_commit_traversal_request(struct imsgb return got_error_from_errno("imsg_add " "COMMIT_TRAVERSAL_REQUEST"); - wbuf->fd = -1; imsg_close(ibuf, wbuf); - return flush_imsg(ibuf); } @@ -2803,7 +2794,6 @@ got_privsep_send_enumerated_tree(size_t *totlen, struc if (imsg_add(wbuf, path, path_len) == -1) return got_error_from_errno("imsg_add ENUMERATED_TREE"); - wbuf->fd = -1; imsg_close(ibuf, wbuf); if (entries) { @@ -2865,7 +2855,6 @@ got_privsep_send_enumerated_commit(struct imsgbuf *ibu if (imsg_add(wbuf, &mtime, sizeof(mtime)) == -1) return got_error_from_errno("imsg_add ENUMERATED_COMMIT"); - wbuf->fd = -1; imsg_close(ibuf, wbuf); /* Don't flush yet, tree entries or ENUMERATION_DONE will follow. */ return NULL; @@ -3195,7 +3184,6 @@ send_idlist(struct imsgbuf *ibuf, struct got_object_id return got_error_from_errno("imsg_add OBJ_ID_LIST"); } - wbuf->fd = -1; imsg_close(ibuf, wbuf); return flush_imsg(ibuf); @@ -3332,7 +3320,6 @@ got_privsep_send_reused_deltas(struct imsgbuf *ibuf, return got_error_from_errno("imsg_add REUSED_DELTAS"); } - wbuf->fd = -1; imsg_close(ibuf, wbuf); return flush_imsg(ibuf); @@ -3469,9 +3456,7 @@ send_painted_commits(struct got_object_id_queue *ids, got_object_qid_free(qid); } - wbuf->fd = -1; imsg_close(ibuf, wbuf); - return flush_imsg(ibuf); }