All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Tools: hv: fix file overwriting of hv_fcopy_daemon
@ 2014-06-28  0:16 Yue Zhang
  2014-06-27 23:20 ` KY Srinivasan
  2014-06-27 23:45 ` Greg KH
  0 siblings, 2 replies; 7+ messages in thread
From: Yue Zhang @ 2014-06-28  0:16 UTC (permalink / raw)
  To: kys, haiyangz, driverdev-devel, linux-kernel, olaf, jasowang, apw
  Cc: decui, huishao

From: Yue Zhang <yuezha@microsoft.com>

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

Add O_TRUNC flag on opening.

MS-TFS: 341345

Signed-off-by: Yue Zhang <yuezha@microsoft.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


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH] Tools: hv: fix file overwriting of hv_fcopy_daemon
@ 2014-06-26 21:09 Yue Zhang
  2014-06-26 20:43 ` KY Srinivasan
  0 siblings, 1 reply; 7+ messages in thread
From: Yue Zhang @ 2014-06-26 21:09 UTC (permalink / raw)
  To: kys, haiyangz, driverdev-devel, linux-kernel, olaf, jasowang, apw
  Cc: decui, huishao

From: Yue Zhang <yuezha@microsoft.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@microsoft.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..01eee6b 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-06-27 23:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-28  0:16 [PATCH] Tools: hv: fix file overwriting of hv_fcopy_daemon Yue Zhang
2014-06-27 23:20 ` KY Srinivasan
2014-06-27 23:45 ` Greg KH
2014-06-27 23:45   ` Yue Zhang (OSTC DEV)
  -- strict thread matches above, loose matches on Subject: below --
2014-06-26 21:09 Yue Zhang
2014-06-26 20:43 ` KY Srinivasan
2014-06-26 20:58   ` Yue Zhang (OSTC DEV)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.