qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH v2 2/2] qga: unlink just created guest-file if fchmo


From: Laszlo Ersek
Subject: [Qemu-devel] [PATCH v2 2/2] qga: unlink just created guest-file if fchmod() or fdopen() fails on it
Date: Wed, 8 May 2013 17:31:36 +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 |    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




reply via email to

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