From 2b720018060179b394f8ce736983373ab80dd37c Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Wed, 8 May 2013 17:31:36 +0200 Subject: qga: unlink just created guest-file if fchmod() or fdopen() fails on it We shouldn't allow guest filesystem pollution on error paths. Suggested-by: Eric Blake Signed-off-by: Laszlo Ersek Reviewed-by: Eric Blake Reviewed-by: Luiz Capitulino Signed-off-by: Michael Roth --- qga/commands-posix.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'qga') 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); + } } } -- cgit v1.1