qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: mdroth@linux.vnet.ibm.com
Cc: blauwirbel@gmail.com, qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH v2] qemu-ga: ga_open_pidfile(): add new line to pidfile
Date: Wed, 3 Oct 2012 18:40:01 -0300	[thread overview]
Message-ID: <20121003184001.219ab404@doriath.home> (raw)

FHS requires that pid files should end with a new line. Also change to
snprintf() while there.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---

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

             reply	other threads:[~2012-10-03 21:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-03 21:40 Luiz Capitulino [this message]
2012-10-04 15:48 ` [Qemu-devel] [PATCH v2] qemu-ga: ga_open_pidfile(): add new line to pidfile Michael Roth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121003184001.219ab404@doriath.home \
    --to=lcapitulino@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).