mirror of
https://git.proxmox.com/git/qemu
synced 2025-06-22 23:46:47 +00:00
block: Don't forget to delete temporary file
The caller would not delete temporary file after failed get_tmp_filename(). Signed-off-by: Dunrong Huang <riegamaths@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
f0536bb848
commit
fe235a06e1
6
block.c
6
block.c
@ -433,7 +433,11 @@ int get_tmp_filename(char *filename, int size)
|
|||||||
return -EOVERFLOW;
|
return -EOVERFLOW;
|
||||||
}
|
}
|
||||||
fd = mkstemp(filename);
|
fd = mkstemp(filename);
|
||||||
if (fd < 0 || close(fd)) {
|
if (fd < 0) {
|
||||||
|
return -errno;
|
||||||
|
}
|
||||||
|
if (close(fd) != 0) {
|
||||||
|
unlink(filename);
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user