projects
/
sdk
/
emulator
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f0536bb
)
block: Don't forget to delete temporary file
author
Dunrong Huang
<riegamaths@gmail.com>
Wed, 5 Sep 2012 13:26:22 +0000
(21:26 +0800)
committer
Kevin Wolf
<kwolf@redhat.com>
Wed, 12 Sep 2012 13:50:09 +0000
(15:50 +0200)
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>
block.c
patch
|
blob
|
history
diff --git
a/block.c
b/block.c
index c754353ac6bbb90b9d71f36133216abb88698d70..e78039bd5a089380d29b9305c99b7ad1e6a163d2 100644
(file)
--- a/
block.c
+++ b/
block.c
@@
-433,7
+433,11
@@
int get_tmp_filename(char *filename, int size)
return -EOVERFLOW;
}
fd = mkstemp(filename);
- if (fd < 0 || close(fd)) {
+ if (fd < 0) {
+ return -errno;
+ }
+ if (close(fd) != 0) {
+ unlink(filename);
return -errno;
}
return 0;