aboutsummaryrefslogtreecommitdiffstats
path: root/t/helper/test-truncate.c
diff options
context:
space:
mode:
authorHoyoung Lee <lhywkd22@gmail.com>2025-07-22 17:41:01 +0000
committerJunio C Hamano <gitster@pobox.com>2025-07-22 14:05:34 -0700
commit8cc19250b324c90f4283bcad488c8bbc756145c4 (patch)
treefb8dd0d83756a4f8238d7ded32da74aaf2483214 /t/helper/test-truncate.c
parentGit 2.50 (diff)
downloadgit-8cc19250b324c90f4283bcad488c8bbc756145c4.tar.gz
git-8cc19250b324c90f4283bcad488c8bbc756145c4.zip
t/helper/test-truncate: close file descriptor after truncation
Fix a resource leak where the file descriptor was not closed after truncating a file in t/helper/test-truncate.c. Signed-off-by: Hoyoung Lee <lhywkd22@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper/test-truncate.c')
-rw-r--r--t/helper/test-truncate.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/t/helper/test-truncate.c b/t/helper/test-truncate.c
index 3931deaec7..2820cc7ed7 100644
--- a/t/helper/test-truncate.c
+++ b/t/helper/test-truncate.c
@@ -21,5 +21,8 @@ int cmd__truncate(int argc, const char **argv)
if (ftruncate(fd, (off_t) sz) < 0)
die_errno("failed to truncate file");
+
+ close(fd);
+
return 0;
}