Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754335AbaF0XUO (ORCPT ); Fri, 27 Jun 2014 19:20:14 -0400 Received: from mail-by2lp0236.outbound.protection.outlook.com ([207.46.163.236]:28200 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751745AbaF0XUM convert rfc822-to-8bit (ORCPT ); Fri, 27 Jun 2014 19:20:12 -0400 From: KY Srinivasan To: "Yue Zhang (OSTC DEV)" , 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: RE: [PATCH] Tools: hv: fix file overwriting of hv_fcopy_daemon Thread-Topic: [PATCH] Tools: hv: fix file overwriting of hv_fcopy_daemon Thread-Index: AQHPkl3sCu+G7SXcCkCbF+fIpgaFm5uFl1Eg Date: Fri, 27 Jun 2014 23:20:10 +0000 Message-ID: References: <1403914608-21604-1-git-send-email-yuezha@microsoft.com> In-Reply-To: <1403914608-21604-1-git-send-email-yuezha@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [50.135.110.52] x-microsoft-antispam: BL:0;ACTION:Default;RISK:Low;SCL:0;SPMLVL:NotSpam;PCL:0;RULEID: x-forefront-prvs: 0255DF69B9 x-forefront-antispam-report: SFV:NSPM;SFS:(6009001)(377454003)(199002)(189002)(13464003)(51704005)(19580405001)(64706001)(83322001)(66066001)(85852003)(83072002)(80022001)(101416001)(76482001)(20776003)(92566001)(19580395003)(77982001)(33646001)(46102001)(76576001)(2656002)(50986999)(87936001)(54356999)(4396001)(81342001)(21056001)(76176999)(106356001)(31966008)(99286002)(95666004)(85306003)(86362001)(2201001)(74316001)(99396002)(105586002)(81542001)(107046002)(106116001)(74662001)(1511001)(79102001)(74502001)(24736002);DIR:OUT;SFP:;SCL:1;SRVR:BY2PR03MB300;H:BY2PR03MB299.namprd03.prod.outlook.com;FPR:;MLV:sfv;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: microsoft.onmicrosoft.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Yue Zhang [mailto:yuezha@microsoft.com] > Sent: Friday, June 27, 2014 5:17 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 > > hv_fcopy_daemon fails to overwrite a file if the target file already exits. > > Add O_TRUNC flag on opening. > > MS-TFS: 341345 You need to include Greg in the "to list". Also get rid of the MS-TFS tag. > > Signed-off-by: Yue Zhang > --- > 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); Please align properly and there is no need for three lines here. K. Y -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/