Skip to content

Commit 8cc1925

Browse files
lhywkgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 16bd9f2 commit 8cc1925

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

t/helper/test-truncate.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,8 @@ int cmd__truncate(int argc, const char **argv)
2121

2222
if (ftruncate(fd, (off_t) sz) < 0)
2323
die_errno("failed to truncate file");
24+
25+
close(fd);
26+
2427
return 0;
2528
}

0 commit comments

Comments
 (0)