From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tsggk-0006IS-Rz for qemu-devel@nongnu.org; Tue, 08 Jan 2013 16:26:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tsggj-00055h-Q3 for qemu-devel@nongnu.org; Tue, 08 Jan 2013 16:26:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:65446) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tsggj-00055d-IT for qemu-devel@nongnu.org; Tue, 08 Jan 2013 16:26:25 -0500 From: Luiz Capitulino Date: Tue, 8 Jan 2013 19:26:25 -0200 Message-Id: <1357680386-10904-2-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1357680386-10904-1-git-send-email-lcapitulino@redhat.com> References: <1357680386-10904-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 1/2] qemu-ga: ga_open_pidfile(): use qemu_open() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mdroth@linux.vnet.ibm.com This ensures that O_CLOEXEC is passed to open(), this way the pid file fd is not leaked to executed processes. Signed-off-by: Luiz Capitulino --- qga/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qga/main.c b/qga/main.c index ba5fa1c..e4245cc 100644 --- a/qga/main.c +++ b/qga/main.c @@ -242,7 +242,7 @@ static bool ga_open_pidfile(const char *pidfile) int pidfd; char pidstr[32]; - pidfd = open(pidfile, O_CREAT|O_WRONLY, S_IRUSR|S_IWUSR); + pidfd = qemu_open(pidfile, O_CREAT|O_WRONLY, S_IRUSR|S_IWUSR); if (pidfd == -1 || lockf(pidfd, F_TLOCK, 0)) { g_critical("Cannot lock pid file, %s", strerror(errno)); if (pidfd != -1) { -- 1.8.0