summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2012-11-22 07:25:48 +0100
committerDoug Goldstein <cardoe@cardoe.com>2012-12-13 15:31:59 -0600
commitf480621e34775647c8f2cf1a9721a50a46cd4f24 (patch)
tree47546e9a9d488ea6b47f9263133931b6043a2824
parenttci: Fix type of tci_read_label (diff)
downloadqemu-kvm-f480621e34775647c8f2cf1a9721a50a46cd4f24.tar.gz
qemu-kvm-f480621e34775647c8f2cf1a9721a50a46cd4f24.tar.bz2
qemu-kvm-f480621e34775647c8f2cf1a9721a50a46cd4f24.zip
block: Fix regression for MinGW (assertion caused by short string)
The local string tmp_filename is passed to function get_tmp_filename which expects a string with minimum size MAX_PATH for w32 hosts. MAX_PATH is 260 and PATH_MAX is 259, so tmp_filename was too short. Commit eba25057b9a5e19d10ace2bc7716667a31297169 introduced this regression. Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com> (cherry picked from commit 89c9bc3d147fdaa932db99b0463b4af1d3e7cda1) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> (cherry picked from commit 4fb9656b9d62ce348656a7184ac7861d70c490a7)
-rw-r--r--block.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/block.c b/block.c
index 4c0e7f543..e49a9996e 100644
--- a/block.c
+++ b/block.c
@@ -739,7 +739,8 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags,
BlockDriver *drv)
{
int ret;
- char tmp_filename[PATH_MAX];
+ /* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */
+ char tmp_filename[PATH_MAX + 1];
if (flags & BDRV_O_SNAPSHOT) {
BlockDriverState *bs1;