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

Commit 314672a2 authored by K. Y. Srinivasan's avatar K. Y. Srinivasan Committed by Greg Kroah-Hartman
Browse files

Tools: hv: Handle the case when the target file exists correctly



Return the appropriate error code and handle the case when the target
file exists correctly. This fixes a bug.

Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Cc: <stable@vger.kernel.org> [3.14]
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 177581fa
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -305,6 +305,7 @@ enum hv_kvp_exchg_pool {
#define HV_ERROR_DEVICE_NOT_CONNECTED	0x8007048F
#define HV_INVALIDARG			0x80070057
#define HV_GUID_NOTFOUND		0x80041002
#define HV_ERROR_ALREADY_EXISTS		0x80070050

#define ADDR_FAMILY_NONE	0x00
#define ADDR_FAMILY_IPV4	0x01
+3 −1
Original line number Diff line number Diff line
@@ -82,9 +82,11 @@ static int hv_start_fcopy(struct hv_start_fcopy *smsg)

	if (!access(target_fname, F_OK)) {
		syslog(LOG_INFO, "File: %s exists", target_fname);
		if (!smsg->copy_flags & OVER_WRITE)
		if (!(smsg->copy_flags & OVER_WRITE)) {
			error = HV_ERROR_ALREADY_EXISTS;
			goto done;
		}
	}

	target_fd = open(target_fname, O_RDWR | O_CREAT | O_CLOEXEC, 0744);
	if (target_fd == -1) {