[PATCH v2 1/4] t/helper/test-truncate: close file descriptor after truncation
- From
Hoyoung Lee <lhywkd22@gmail.com>
- Date
- Jul 22, 2025, 08:12 UTC
- Message-ID
- <20250722081219.1086866-2-lhywkd22@gmail.com>
- In-Reply-To
- <20250722081219.1086866-1-lhywkd22@gmail.com>
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> --- t/helper/test-truncate.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/t/helper/test-truncate.c b/t/helper/test-truncate.c index 3931deaec7..104bc36cc0 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; }
-- 2.34.1