mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 06:10:56 +00:00
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: Yue Zhang <yuezha@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
da86920f4a
commit
e013ac312c
1 changed files with 2 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue