aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
Diffstat (limited to 'block.c')
-rw-r--r--block.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/block.c b/block.c
index efd96e637f..6924cee67d 100644
--- a/block.c
+++ b/block.c
@@ -150,13 +150,19 @@ int bdrv_create(BlockDriver *drv,
}
#ifdef _WIN32
-static void get_tmp_filename(char *filename, int size)
+void get_tmp_filename(char *filename, int size)
{
+ char* p = strrchr(filename, '/');
+
+ if (p == NULL)
+ return;
+
/* XXX: find a better function */
- tmpnam(filename);
+ tmpnam(p);
+ *p = '/';
}
#else
-static void get_tmp_filename(char *filename, int size)
+void get_tmp_filename(char *filename, int size)
{
int fd;
/* XXX: race condition possible */
@@ -394,6 +400,10 @@ int bdrv_commit(BlockDriverState *bs)
i += n;
}
}
+
+ if (bs->drv->bdrv_make_empty)
+ return bs->drv->bdrv_make_empty(bs);
+
return 0;
}