{"thread":{"id":"58455","subject":"[PATCH v2] commit-graph: Fix missing closedir in expire_commit_graphs","startedAt":"2022-09-19T14:14:58Z","lastAt":"2022-09-19T17:41:30Z","messageCount":3,"participants":["Miaoqian Lin","Derrick Stolee","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"463173","messageId":"20220919141441.5644-1-linmq006@gmail.com","threadId":"58455","inReplyTo":null,"subject":"[PATCH v2] commit-graph: Fix missing closedir in expire_commit_graphs","fromName":"Miaoqian Lin","fromEmail":"linmq006@gmail.com","sentAt":"2022-09-19T14:14:40Z","receivedAt":"2022-09-19T14:14:58Z","isPatch":true,"sender":{"key":"linmq006@gmail.com","avatar":null},"body":"The function calls opendir() but missing the corresponding\nclosedir() before exit the function.\nAdd missing closedir() to fix it.\n\nSigned-off-by: Miaoqian Lin <linmq006@gmail.com>\n---\nchanges in v2:\n- add if (dir) before closedir(), as suggested by Derrick.\n---\n commit-graph.c | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/commit-graph.c b/commit-graph.c\nindex 06f7d9e0b6af..a7d875593288 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -2265,6 +2265,8 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx)\n \t}\n \n out:\n+\tif(dir)\n+\t\tclosedir(dir);\n \tstrbuf_release(&path);\n }\n \n-- \n2.25.1\n\n"},{"id":"463180","messageId":"4f1cf64e-2864-a979-6f75-d9d4148d57da@github.com","threadId":"58455","inReplyTo":"20220919141441.5644-1-linmq006@gmail.com","subject":"Re: [PATCH v2] commit-graph: Fix missing closedir in expire_commit_graphs","fromName":"Derrick Stolee","fromEmail":"derrickstolee@github.com","sentAt":"2022-09-19T15:04:46Z","receivedAt":"2022-09-19T15:04:56Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 9/19/2022 10:14 AM, Miaoqian Lin wrote:\n> The function calls opendir() but missing the corresponding\n> closedir() before exit the function.\n> Add missing closedir() to fix it.\n\nThanks for the patch, Miaoqian.\n\nI only have a very tiny nitpick with the line breaks in your\ncommit message. Either the \"Add missing...\" sentence should\nstart immediately after the previous sentence or have another\nline break between the paragraphs. This shouldn't merit a\nre-roll, but keep it in mind for future contributions.\n\n>  out:\n> +\tif(dir)\n> +\t\tclosedir(dir);\n>  \tstrbuf_release(&path);\n>  }\n\nThis change looks correct to me. Thanks!\n-Stolee\n"},{"id":"463204","messageId":"xmqq7d1zb6ta.fsf@gitster.g","threadId":"58455","inReplyTo":"4f1cf64e-2864-a979-6f75-d9d4148d57da@github.com","subject":"Re: [PATCH v2] commit-graph: Fix missing closedir in expire_commit_graphs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-09-19T17:41:21Z","receivedAt":"2022-09-19T17:41:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Derrick Stolee <derrickstolee@github.com> writes:\n\n> On 9/19/2022 10:14 AM, Miaoqian Lin wrote:\n>> The function calls opendir() but missing the corresponding\n>> closedir() before exit the function.\n>> Add missing closedir() to fix it.\n>\n> Thanks for the patch, Miaoqian.\n>\n> I only have a very tiny nitpick with the line breaks in your\n> commit message. Either the \"Add missing...\" sentence should\n> start immediately after the previous sentence or have another\n> line break between the paragraphs. This shouldn't merit a\n> re-roll, but keep it in mind for future contributions.\n>\n>>  out:\n>> +\tif(dir)\n>> +\t\tclosedir(dir);\n>>  \tstrbuf_release(&path);\n>>  }\n>\n> This change looks correct to me. Thanks!\n> -Stolee\n\nThanks, both.  Looking good.\n"}]}