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>
---
 qga/commands-posix.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 2eec712..d301b1f 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -341,6 +341,7 @@ safe_open_or_create(const char *path, const char *mode, 
Error **err)
                 error_setg_errno(&local_err, errno, "failed to set permission "
                                  "0%03o on new file '%s' (mode: '%s')",
                                  (unsigned)DEFAULT_NEW_FILE_MODE, path, mode);
+                unlink(path);
             } else {
                 FILE *f;
 
-- 
1.7.1


Reply via email to