From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuqCj-0001G3-J9 for qemu-devel@nongnu.org; Mon, 14 Jan 2013 15:00:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TuqCc-0008N5-Kx for qemu-devel@nongnu.org; Mon, 14 Jan 2013 15:00:21 -0500 Received: from mail-ie0-f180.google.com ([209.85.223.180]:53710) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuqCc-0008K5-Gd for qemu-devel@nongnu.org; Mon, 14 Jan 2013 15:00:14 -0500 Received: by mail-ie0-f180.google.com with SMTP id c10so5619133ieb.39 for ; Mon, 14 Jan 2013 12:00:09 -0800 (PST) Sender: fluxion From: Michael Roth Date: Mon, 14 Jan 2013 13:55:05 -0600 Message-Id: <1358193312-15960-2-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1358193312-15960-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1358193312-15960-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 1/8] 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: aliguori@us.ibm.com, armbru@redhat.com, lcapitulino@redhat.com From: Luiz Capitulino 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 Reviewed-by: Eric Blake Acked-by: Amos Kong Tested-by: Amos Kong Signed-off-by: Michael Roth --- qga/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qga/main.c b/qga/main.c index a9b968c..4239150 100644 --- a/qga/main.c +++ b/qga/main.c @@ -267,7 +267,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.7.9.5