[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/2] qga: unlink just created guest-file if fchmod()
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 2/2] qga: unlink just created guest-file if fchmod() or fdopen() fails on it |
Date: |
Mon, 13 May 2013 10:08:23 -0500 |
From: Laszlo Ersek <address@hidden>
We shouldn't allow guest filesystem pollution on error paths.
Suggested-by: Eric Blake <address@hidden>
Signed-off-by: Laszlo Ersek <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Luiz Capitulino <address@hidden>
Signed-off-by: Michael Roth <address@hidden>
---
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