Received: from eggs.gnu.org ([2001:4830:134:3::10]:58078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwB2p-00014z-Bq for qemu-devel@nongnu.org; Tue, 10 Nov 2015 10:41:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZwB2k-0004um-Cg for qemu-devel@nongnu.org; Tue, 10 Nov 2015 10:41:15 -0500 Received: from e32.co.us.ibm.com ([32.97.110.150]:38831) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwB2k-0004uc-7I for qemu-devel@nongnu.org; Tue, 10 Nov 2015 10:41:10 -0500 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 10 Nov 2015 08:41:07 -0700 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <1447105745-32358-1-git-send-email-kallan@suse.com> References: <1447105745-32358-1-git-send-email-kallan@suse.com> Message-ID: <20151110154059.25378.38107@loki> Date: Tue, 10 Nov 2015 09:40:59 -0600 Subject: Re: [Qemu-devel] [PATCH] qga: fix append file open modes for win32 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kirk Allan , qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org Quoting Kirk Allan (2015-11-09 15:49:05) > For append file open modes, use FILE_APPEND_DATA for the desired access f= or writing at the end of the file. > = > Signed-off-by: Kirk Allan > --- > qga/commands-win32.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > = > diff --git a/qga/commands-win32.c b/qga/commands-win32.c > index a5306e7..0a23b9b 100644 > --- a/qga/commands-win32.c > +++ b/qga/commands-win32.c > @@ -70,16 +70,16 @@ static OpenFlags guest_file_open_modes[] =3D { > {"rb", GENERIC_READ, OPEN_EXISTING}, > {"w", GENERIC_WRITE, CREATE_ALWAYS}, > {"wb", GENERIC_WRITE, CREATE_ALWAYS}, > - {"a", GENERIC_WRITE, OPEN_ALWAYS }, > + {"a", FILE_APPEND_DATA, OPEN_ALWAYS }, > {"r+", GENERIC_WRITE|GENERIC_READ, OPEN_EXISTING}, > {"rb+", GENERIC_WRITE|GENERIC_READ, OPEN_EXISTING}, > {"r+b", GENERIC_WRITE|GENERIC_READ, OPEN_EXISTING}, > {"w+", GENERIC_WRITE|GENERIC_READ, CREATE_ALWAYS}, > {"wb+", GENERIC_WRITE|GENERIC_READ, CREATE_ALWAYS}, > {"w+b", GENERIC_WRITE|GENERIC_READ, CREATE_ALWAYS}, > - {"a+", GENERIC_WRITE|GENERIC_READ, OPEN_ALWAYS }, > - {"ab+", GENERIC_WRITE|GENERIC_READ, OPEN_ALWAYS }, > - {"a+b", GENERIC_WRITE|GENERIC_READ, OPEN_ALWAYS } > + {"a+", FILE_APPEND_DATA, OPEN_ALWAYS }, > + {"ab+", FILE_APPEND_DATA, OPEN_ALWAYS }, > + {"a+b", FILE_APPEND_DATA, OPEN_ALWAYS } Cc'ing qemu-stable@nongnu.org Thanks for catching this, accidentally truncating files is certainly not good... I hit an issue testing this though, this does fix the append case, but a+, ab+, a+b all imply append+read, while FILE_APPEND_DATA only grants append access. FILE_APPEND_DATA|GENERIC_READ seems to work, but I'm not finding much official documentation on what's valid with FILE_APPEND_DATA. Do you have a reference that might confirm this is valid usage? The only reference to FILE_APPEND_DATA I saw was a single comment in: https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=3Dvs.85= ).aspx I'd like to get this in soon for 2.5 (hard freeze / rc0 is thursday). > }; > = > static OpenFlags *find_open_flag(const char *mode_str) > -- = > 1.8.5.6 >=20