Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e013ac31 authored by Yue Zhang's avatar Yue Zhang Committed by Greg Kroah-Hartman
Browse files

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: default avatarYue Zhang <yuezha@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent da86920f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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;