Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 8024730

Browse files
committed
Merge pull request #104 from gao-feng/fd
close fd in hyper_create
2 parents 5b7069c + 211eb96 commit 8024730

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/hyper.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,12 @@ static inline int hyper_unlink(char *hyper_path)
106106

107107
static inline int hyper_create(char *hyper_path)
108108
{
109-
return creat(hyper_path, 0755);
109+
int fd = creat(hyper_path, 0755);
110+
if (fd < 0)
111+
return -1;
112+
113+
close(fd);
114+
return 0;
110115
}
111116

112117
int hyper_mkdir(char *hyper_path);

0 commit comments

Comments
 (0)