From 211eb96eb65b5629014e5130701564498e2e5e16 Mon Sep 17 00:00:00 2001 From: Gao feng Date: Tue, 24 May 2016 15:59:17 +0800 Subject: [PATCH] close fd in hyper_create Signed-off-by: Gao feng --- src/hyper.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/hyper.h b/src/hyper.h index 7b0915c..431a429 100644 --- a/src/hyper.h +++ b/src/hyper.h @@ -106,7 +106,12 @@ static inline int hyper_unlink(char *hyper_path) static inline int hyper_create(char *hyper_path) { - return creat(hyper_path, 0755); + int fd = creat(hyper_path, 0755); + if (fd < 0) + return -1; + + close(fd); + return 0; } int hyper_mkdir(char *hyper_path);