qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] qemu-ga: ga_open_pidfile(): add new line to pidfile
@ 2012-10-03 21:40 Luiz Capitulino
  2012-10-04 15:48 ` Michael Roth
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Capitulino @ 2012-10-03 21:40 UTC (permalink / raw)
  To: mdroth; +Cc: blauwirbel, qemu-devel

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH v2] qemu-ga: ga_open_pidfile(): add new line to pidfile
  2012-10-03 21:40 [Qemu-devel] [PATCH v2] qemu-ga: ga_open_pidfile(): add new line to pidfile Luiz Capitulino
@ 2012-10-04 15:48 ` Michael Roth
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Roth @ 2012-10-04 15:48 UTC (permalink / raw)
  To: Luiz Capitulino; +Cc: blauwirbel, 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 <lcapitulino@redhat.com>

Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.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
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-04 16:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-03 21:40 [Qemu-devel] [PATCH v2] qemu-ga: ga_open_pidfile(): add new line to pidfile Luiz Capitulino
2012-10-04 15:48 ` Michael Roth

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).