We shouldn't allow guest filesystem pollution on error paths.
Suggested-by: Eric Blake <[email protected]>
Signed-off-by: Laszlo Ersek <[email protected]>
---
qga/commands-posix.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
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.1