From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42097) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UbuOf-0007wY-MZ for qemu-devel@nongnu.org; Mon, 13 May 2013 11:10:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UbuOe-0004jq-8M for qemu-devel@nongnu.org; Mon, 13 May 2013 11:10:41 -0400 Received: from mail-ie0-x22d.google.com ([2607:f8b0:4001:c03::22d]:33925) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UbuOe-0004jl-3E for qemu-devel@nongnu.org; Mon, 13 May 2013 11:10:40 -0400 Received: by mail-ie0-f173.google.com with SMTP id k5so12557701iea.32 for ; Mon, 13 May 2013 08:10:39 -0700 (PDT) Sender: fluxion From: Michael Roth Date: Mon, 13 May 2013 10:08:23 -0500 Message-Id: <1368457703-30663-3-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1368457703-30663-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1368457703-30663-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 2/2] qga: unlink just created guest-file if fchmod() or fdopen() fails on it List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, lersek@redhat.com From: Laszlo Ersek 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(+) 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