From 788e80ce39a113d94d56b316c13c2b93def78f17 Mon Sep 17 00:00:00 2001 From: Gao feng Date: Mon, 28 Sep 2015 17:30:41 +0800 Subject: [PATCH] tuncate file in write file command Signed-off-by: Gao feng --- src/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/init.c b/src/init.c index cdb793c..aaf9c16 100644 --- a/src/init.c +++ b/src/init.c @@ -791,7 +791,7 @@ static int hyper_cmd_write_file(char *json, int length) goto exit; } - fd = open(writter.file, O_CREAT| O_WRONLY, 0644); + fd = open(writter.file, O_CREAT| O_TRUNC| O_WRONLY, 0644); if (fd < 0) { perror("fail to open target file"); goto exit;