block: Unlink temporary file
PATCH 1/1 block: Unlink temporary file
If the image file cannot be opened and was created as a temporary file, it should be deleted; thus, in this case, we should jump to the "unlink_and_fail" label and not just to "fail".
---
This patch's context depends on my bdrv_open()/bdrv_file_open() series ("[PATCH v3 0/8] block: Integrate bdrv_file_open() into bdrv_open()").
--- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block.c +1 -1
@@ -1308,7 +1308,7 @@ int bdrv_open(BlockDriverState **pbs, const char *filename,bdrv_open_flags (bs, flags |BDRV_O_UNMAP ) | BDRV_O_PROTOCOL, true, &local_err);if (ret <0 ) { - goto fail; + goto unlink_and_fail; }/* Find the right image format driver */
Signature · 1 line
1.8.5.4
Quoted 18 lines · Max Reitz
If the image file cannot be opened and was created as a temporary file, it should be deleted; thus, in this case, we should jump to the "
unlink_and_fail" label and not just to "fail".Reported-by Benoît Canet <[email protected]>Signed-off-by Max Reitz <[email protected]>---
This patch's context depends on my bdrv_open()/bdrv_file_open() series ("[PATCH v3 0/8] block: Integratebdrv_file_open()intobdrv_open()").--- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)block.c +0
-0
block.c int bdrv_open(BlockDriverState **pbs, const char *filename, · line 1314
Quoted 8 lines
block.c +1
-1@@ -1308,7 +1308,7 @@ int bdrv_open(BlockDriverState **pbs, const char *filename,bdrv_open_flags (bs, flags |BDRV_O_UNMAP ) | BDRV_O_PROTOCOL, true, &local_err);if (ret <0 ) { - goto fail; + goto unlink_and_fail; }/* Find the right image format driver */
Stefan Hajnoczi
AppliedQuoted 4 lines · Max Reitz
If the image file cannot be opened and was created as a temporary file, it should be deleted; thus, in this case, we should jump to the "
unlink_and_fail" label and not just to "fail".
Quoted 8 lines
Reported-by Benoît Canet <[email protected]>Signed-off-by Max Reitz <[email protected]>---
This patch's context depends on my bdrv_open()/bdrv_file_open() series ("[PATCH v3 0/8] block: Integratebdrv_file_open()intobdrv_open()").--- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan