From: Laszlo Ersek <ler...@redhat.com> We shouldn't allow guest filesystem pollution on error paths.
Suggested-by: Eric Blake <ebl...@redhat.com> Signed-off-by: Laszlo Ersek <ler...@redhat.com> Reviewed-by: Eric Blake <ebl...@redhat.com> Reviewed-by: Luiz Capitulino <lcapitul...@redhat.com> Signed-off-by: Michael Roth <mdr...@linux.vnet.ibm.com> --- qga/commands-posix.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 2eec712..e199738 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -355,6 +355,9 @@ safe_open_or_create(const char *path, const char *mode, Error **err) } close(fd); + if (oflag & O_CREAT) { + unlink(path); + } } } -- 1.7.9.5