From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJoPp-0001Hc-Cy for qemu-devel@nongnu.org; Thu, 04 Oct 2012 12:36:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJoPj-0004bp-Jg for qemu-devel@nongnu.org; Thu, 04 Oct 2012 12:36:49 -0400 Received: from mail-oa0-f45.google.com ([209.85.219.45]:33451) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJnfQ-0006pe-5z for qemu-devel@nongnu.org; Thu, 04 Oct 2012 11:48:52 -0400 Received: by mail-oa0-f45.google.com with SMTP id i18so587402oag.4 for ; Thu, 04 Oct 2012 08:48:51 -0700 (PDT) Sender: fluxion Date: Thu, 4 Oct 2012 10:48:43 -0500 From: Michael Roth Message-ID: <20121004154843.GG16157@illuin> References: <20121003184001.219ab404@doriath.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121003184001.219ab404@doriath.home> Subject: Re: [Qemu-devel] [PATCH v2] qemu-ga: ga_open_pidfile(): add new line to pidfile List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: blauwirbel@gmail.com, qemu-devel On Wed, Oct 03, 2012 at 06:40:01PM -0300, Luiz Capitulino wrote: > 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; > -- > 1.7.12.315.g682ce8b >