orion / rpms / qemu

Forked from rpms/qemu 4 years ago
Clone
fa00e1e
From 767241bd6e8982aebff143967a5808224c61b83e Mon Sep 17 00:00:00 2001
f375e62
From: Stefan Weil <sw@weilnetz.de>
f375e62
Date: Thu, 22 Nov 2012 07:25:48 +0100
f375e62
Subject: [PATCH] block: Fix regression for MinGW (assertion caused by short
f375e62
 string)
f375e62
f375e62
The local string tmp_filename is passed to function get_tmp_filename
f375e62
which expects a string with minimum size MAX_PATH for w32 hosts.
f375e62
f375e62
MAX_PATH is 260 and PATH_MAX is 259, so tmp_filename was too short.
f375e62
f375e62
Commit eba25057b9a5e19d10ace2bc7716667a31297169 introduced this
f375e62
regression.
f375e62
f375e62
Signed-off-by: Stefan Weil <sw@weilnetz.de>
f375e62
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
f375e62
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
f375e62
(cherry picked from commit 89c9bc3d147fdaa932db99b0463b4af1d3e7cda1)
f375e62
f375e62
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
f375e62
---
f375e62
 block.c | 3 ++-
f375e62
 1 file changed, 2 insertions(+), 1 deletion(-)
f375e62
f375e62
diff --git a/block.c b/block.c
f375e62
index 4c0e7f5..e49a999 100644
f375e62
--- a/block.c
f375e62
+++ b/block.c
f375e62
@@ -739,7 +739,8 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags,
f375e62
               BlockDriver *drv)
f375e62
 {
f375e62
     int ret;
f375e62
-    char tmp_filename[PATH_MAX];
f375e62
+    /* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */
f375e62
+    char tmp_filename[PATH_MAX + 1];
f375e62
 
f375e62
     if (flags & BDRV_O_SNAPSHOT) {
f375e62
         BlockDriverState *bs1;