From: KY Srinivasan <kys@microsoft.com>
To: "Yue Zhang (OSTC DEV)" <yuezha@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
"driverdev-devel@linuxdriverproject.org"
<driverdev-devel@linuxdriverproject.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"olaf@aepfle.de" <olaf@aepfle.de>,
"jasowang@redhat.com" <jasowang@redhat.com>,
"apw@canonical.com" <apw@canonical.com>
Cc: Dexuan Cui <decui@microsoft.com>, Thomas Shao <huishao@microsoft.com>
Subject: RE: [PATCH] Tools: hv: fix file overwriting of hv_fcopy_daemon
Date: Thu, 26 Jun 2014 20:43:46 +0000 [thread overview]
Message-ID: <9aa07d3dad7c448da7ee7a3e007e0140@BY2PR03MB299.namprd03.prod.outlook.com> (raw)
In-Reply-To: <1403816968-15419-1-git-send-email-yuezha@microsoft.com>
> -----Original Message-----
> From: Yue Zhang [mailto:yuezha@microsoft.com]
> Sent: Thursday, June 26, 2014 2:09 PM
> To: KY Srinivasan; Haiyang Zhang; driverdev-devel@linuxdriverproject.org;
> linux-kernel@vger.kernel.org; olaf@aepfle.de; jasowang@redhat.com;
> apw@canonical.com
> Cc: Dexuan Cui; Thomas Shao
> Subject: [PATCH] Tools: hv: fix file overwriting of hv_fcopy_daemon
>
> 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 |
Please align O_RDWR to align with the first argument (target_fname).
K. Y
next prev parent reply other threads:[~2014-06-26 20:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-26 21:09 Yue Zhang
2014-06-26 20:43 ` KY Srinivasan [this message]
2014-06-26 20:58 ` Yue Zhang (OSTC DEV)
2014-06-28 0:16 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)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9aa07d3dad7c448da7ee7a3e007e0140@BY2PR03MB299.namprd03.prod.outlook.com \
--to=kys@microsoft.com \
--cc=apw@canonical.com \
--cc=decui@microsoft.com \
--cc=driverdev-devel@linuxdriverproject.org \
--cc=haiyangz@microsoft.com \
--cc=huishao@microsoft.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=olaf@aepfle.de \
--cc=yuezha@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®