From patchwork Wed Oct 3 21:40:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 188936 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A33C32C031C for ; Thu, 4 Oct 2012 07:39:21 +1000 (EST) Received: from localhost ([::1]:40591 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJWf1-00046n-RJ for incoming@patchwork.ozlabs.org; Wed, 03 Oct 2012 17:39:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJWeu-00046F-Gz for qemu-devel@nongnu.org; Wed, 03 Oct 2012 17:39:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJWet-0000b0-Ns for qemu-devel@nongnu.org; Wed, 03 Oct 2012 17:39:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20052) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJWet-0000a3-FW for qemu-devel@nongnu.org; Wed, 03 Oct 2012 17:39:11 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q93Ld7ta016976 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 3 Oct 2012 17:39:07 -0400 Received: from doriath.home (ovpn-113-111.phx2.redhat.com [10.3.113.111]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q93Ld5Dh011492; Wed, 3 Oct 2012 17:39:06 -0400 Date: Wed, 3 Oct 2012 18:40:01 -0300 From: Luiz Capitulino To: mdroth@linux.vnet.ibm.com Message-ID: <20121003184001.219ab404@doriath.home> Organization: Red Hat Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: blauwirbel@gmail.com, qemu-devel Subject: [Qemu-devel] [PATCH v2] qemu-ga: ga_open_pidfile(): add new line to pidfile X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org FHS requires that pid files should end with a new line. Also change to snprintf() while there. Signed-off-by: Luiz Capitulino Reviewed-by: Michael Roth --- o v2 - use snprintf() - re-word changelog qemu-ga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu-ga.c b/qemu-ga.c index b747470..e4026f8 100644 --- a/qemu-ga.c +++ b/qemu-ga.c @@ -255,7 +255,7 @@ static bool ga_open_pidfile(const char *pidfile) g_critical("Failed to truncate pid file"); goto fail; } - sprintf(pidstr, "%d", getpid()); + snprintf(pidstr, sizeof(pidstr), "%d\n", getpid()); if (write(pidfd, pidstr, strlen(pidstr)) != strlen(pidstr)) { g_critical("Failed to write pid file"); goto fail;