qemu-ga patch queue
* fix for unintended overwriting of data on w32 using guest-file-open with append mode -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJWQ73cAAoJEDNTyc7xCLWEaZEH/RIzj1SJF1yIO0DBNIok68Yr rPIjAtucCaQUV0z+lwXeaPp6vMrcWNB2XLnytb4ZZZmMGCy5PQxErmcwZJOS6/Ui Y3gXCVdJv0jNaVRVK16sM6hqchTkHo4MlosEdNnMOO0dp9INy8K60gVZ9HNWrzK3 Ow/6rbYyEhSbecJ+qwLWwtw2DY/GXkmnoFDqzMIR46DPCJcMaRNCNiJ7oVB7OJZx kuMSTBDjlcHX2Vk/eybA8jyM9E97qbc87LhRgpiW3pmkhbC8yfAcIA+T/ALc1Ujk hA54SUISyBPx/QQ/wOusD0nsrVW0juJLAaqe/xKTbaIF8xj9ju3ftqTqS+t7E6I= =9726 -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2015-11-11-tag' into staging qemu-ga patch queue * fix for unintended overwriting of data on w32 using guest-file-open with append mode # gpg: Signature made Wed 11 Nov 2015 22:14:52 GMT using RSA key ID F108B584 # gpg: Good signature from "Michael Roth <flukshun@gmail.com>" # gpg: aka "Michael Roth <mdroth@utexas.edu>" # gpg: aka "Michael Roth <mdroth@linux.vnet.ibm.com>" * remotes/mdroth/tags/qga-pull-2015-11-11-tag: qga: fix append file open modes for win32 Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
fd717e7890
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user