hdparm/0001-hdparm-fallocate-close-fd.patch
2020-07-17 11:29:17 +08:00

17 lines
375 B
Diff

diff --git a/fallocate.c b/fallocate.c
index 4e60459..d73c0f9 100644
--- a/fallocate.c
+++ b/fallocate.c
@@ -39,9 +39,11 @@ int do_fallocate_syscall (const char *path, __u64 bytecount)
err = syscall(SYS_fallocate, fd, mode, offset, len);
if (err >= 0) {
fsync(fd);
+ close(fd);
exit(0);
}
err = errno;
+ close(fd);
unlink(path);
}
perror(path);