From patchwork Wed Oct 3 21:40:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v2] qemu-ga: ga_open_pidfile(): add new line to pidfile Date: Wed, 03 Oct 2012 11:40:01 -0000 From: Luiz Capitulino X-Patchwork-Id: 188936 Message-Id: <20121003184001.219ab404@doriath.home> To: mdroth@linux.vnet.ibm.com Cc: blauwirbel@gmail.com, qemu-devel 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;