提交 e013ac31 编写于 作者: Y Yue Zhang 提交者: Greg Kroah-Hartman

Tools: hv: fix file overwriting of hv_fcopy_daemon

hv_fcopy_daemon fails to overwrite a file if the target file already
exits.

Add O_TRUNC flag on opening.
Signed-off-by: NYue Zhang <yuezha@microsoft.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 da86920f
无相关合并请求
......@@ -88,7 +88,8 @@ static int hv_start_fcopy(struct hv_start_fcopy *smsg)
}
}
target_fd = open(target_fname, O_RDWR | O_CREAT | O_CLOEXEC, 0744);
target_fd = open(target_fname,
O_RDWR | O_CREAT | O_TRUNC | O_CLOEXEC, 0744);
if (target_fd == -1) {
syslog(LOG_INFO, "Open Failed: %s", strerror(errno));
goto done;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部