* [Qemu-devel] [PULL for-2.5 0/1] qemu-ga fix for 2.5
@ 2015-11-11 22:18 Michael Roth
2015-11-11 22:18 ` [Qemu-devel] [PULL for-2.5 1/1] qga: fix append file open modes for win32 Michael Roth
2015-11-12 13:41 ` [Qemu-devel] [PULL for-2.5 0/1] qemu-ga fix for 2.5 Peter Maydell
0 siblings, 2 replies; 3+ messages in thread
From: Michael Roth @ 2015-11-11 22:18 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, qemu-stable
The following changes since commit 3c07587d49458341510360557c849e93e9afaf59:
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-next-20151111' into staging (2015-11-11 09:34:18 +0000)
are available in the git repository at:
git://github.com/mdroth/qemu.git tags/qga-pull-2015-11-11-tag
for you to fetch changes up to 52074d0f662fc51293d4cde8077631f754784405:
qga: fix append file open modes for win32 (2015-11-11 10:21:02 -0600)
----------------------------------------------------------------
qemu-ga patch queue
* fix for unintended overwriting of data on w32 using
guest-file-open with append mode
----------------------------------------------------------------
Kirk Allan (1):
qga: fix append file open modes for win32
qga/commands-win32.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [PULL for-2.5 1/1] qga: fix append file open modes for win32
2015-11-11 22:18 [Qemu-devel] [PULL for-2.5 0/1] qemu-ga fix for 2.5 Michael Roth
@ 2015-11-11 22:18 ` Michael Roth
2015-11-12 13:41 ` [Qemu-devel] [PULL for-2.5 0/1] qemu-ga fix for 2.5 Peter Maydell
1 sibling, 0 replies; 3+ messages in thread
From: Michael Roth @ 2015-11-11 22:18 UTC (permalink / raw)
To: qemu-devel; +Cc: Michael Roth, peter.maydell, qemu-stable, Kirk Allan
From: Kirk Allan <kallan@suse.com>
For append file open modes, use FILE_APPEND_DATA for the desired access
for writing at the end of the file.
Version 2:
For "a+", "ab+", and "a+b" modes use FILE_APPEND_DATA|GENERIC_READ.
ORing in GENERIC_READ starts a read at the begining of the file. All
writes will append to the end fo the file.
Added white space to maintain the alignment of the guest_file_open_modes[].
Signed-off-by: Kirk Allan <kallan@suse.com>
Cc: qemu-stable@nongnu.org
* use FILE_GENERIC_APPEND macro, which provides same semantics as
FILE_APPEND_DATA, but retains other flags from GENERIC_WRITE
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
qga/commands-win32.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index a5306e7..41f6dd9 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -59,6 +59,7 @@ static struct {
.filehandles = QTAILQ_HEAD_INITIALIZER(guest_file_state.filehandles),
};
+#define FILE_GENERIC_APPEND (FILE_GENERIC_WRITE & ~FILE_WRITE_DATA)
typedef struct OpenFlags {
const char *forms;
@@ -66,20 +67,20 @@ typedef struct OpenFlags {
DWORD creation_disposition;
} OpenFlags;
static OpenFlags guest_file_open_modes[] = {
- {"r", GENERIC_READ, OPEN_EXISTING},
- {"rb", GENERIC_READ, OPEN_EXISTING},
- {"w", GENERIC_WRITE, CREATE_ALWAYS},
- {"wb", GENERIC_WRITE, CREATE_ALWAYS},
- {"a", GENERIC_WRITE, 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 }
+ {"r", GENERIC_READ, OPEN_EXISTING},
+ {"rb", GENERIC_READ, OPEN_EXISTING},
+ {"w", GENERIC_WRITE, CREATE_ALWAYS},
+ {"wb", GENERIC_WRITE, CREATE_ALWAYS},
+ {"a", FILE_GENERIC_APPEND, 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+", FILE_GENERIC_APPEND|GENERIC_READ, OPEN_ALWAYS },
+ {"ab+", FILE_GENERIC_APPEND|GENERIC_READ, OPEN_ALWAYS },
+ {"a+b", FILE_GENERIC_APPEND|GENERIC_READ, OPEN_ALWAYS }
};
static OpenFlags *find_open_flag(const char *mode_str)
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PULL for-2.5 0/1] qemu-ga fix for 2.5
2015-11-11 22:18 [Qemu-devel] [PULL for-2.5 0/1] qemu-ga fix for 2.5 Michael Roth
2015-11-11 22:18 ` [Qemu-devel] [PULL for-2.5 1/1] qga: fix append file open modes for win32 Michael Roth
@ 2015-11-12 13:41 ` Peter Maydell
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2015-11-12 13:41 UTC (permalink / raw)
To: Michael Roth; +Cc: QEMU Developers, qemu-stable
On 11 November 2015 at 22:18, Michael Roth <mdroth@linux.vnet.ibm.com> wrote:
> The following changes since commit 3c07587d49458341510360557c849e93e9afaf59:
>
> Merge remote-tracking branch 'remotes/dgibson/tags/ppc-next-20151111' into staging (2015-11-11 09:34:18 +0000)
>
> are available in the git repository at:
>
>
> git://github.com/mdroth/qemu.git tags/qga-pull-2015-11-11-tag
>
> for you to fetch changes up to 52074d0f662fc51293d4cde8077631f754784405:
>
> qga: fix append file open modes for win32 (2015-11-11 10:21:02 -0600)
>
> ----------------------------------------------------------------
> qemu-ga patch queue
>
> * fix for unintended overwriting of data on w32 using
> guest-file-open with append mode
>
> ----------------------------------------------------------------
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-11-12 13:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-11 22:18 [Qemu-devel] [PULL for-2.5 0/1] qemu-ga fix for 2.5 Michael Roth
2015-11-11 22:18 ` [Qemu-devel] [PULL for-2.5 1/1] qga: fix append file open modes for win32 Michael Roth
2015-11-12 13:41 ` [Qemu-devel] [PULL for-2.5 0/1] qemu-ga fix for 2.5 Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).