[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1403915037-21658-1-git-send-email-yuezha@microsoft.com>
Date: Fri, 27 Jun 2014 17:23:57 -0700
From: Yue Zhang <yuezha@...rosoft.com>
To: kys@...rosoft.com, haiyangz@...rosoft.com,
driverdev-devel@...uxdriverproject.org,
linux-kernel@...r.kernel.org, olaf@...fle.de, jasowang@...hat.com,
apw@...onical.com
Cc: decui@...rosoft.com, huishao@...rosoft.com
Subject: [PATCH v2] Tools: hv: fix file overwriting of hv_fcopy_daemon
From: Yue Zhang <yuezha@...rosoft.com>
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@...rosoft.com>
---
tools/hv/hv_fcopy_daemon.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c
index fba1c75..2a86297 100644
--- a/tools/hv/hv_fcopy_daemon.c
+++ b/tools/hv/hv_fcopy_daemon.c
@@ -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;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists