qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/2] qga: try to unlink just created guest-file if f


From: Laszlo Ersek
Subject: [Qemu-devel] [PATCH 2/2] qga: try to unlink just created guest-file if fchmod() fails on it
Date: Tue, 7 May 2013 18:56:48 +0200

We shouldn't allow guest filesystem pollution on error paths.

Suggested-by: Eric Blake <address@hidden>
Signed-off-by: Laszlo Ersek <address@hidden>
---
 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

[Prev in Thread] Current Thread [Next in Thread]