All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu-ga: ga_open_pidfile(): add new line to pidfile
@ 2012-10-03 17:25 Luiz Capitulino
  2012-10-03 20:24 ` Blue Swirl
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Capitulino @ 2012-10-03 17:25 UTC (permalink / raw)
  To: mdroth; +Cc: qemu-devel

FHS dictates that pid files should end with a new line.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 qemu-ga.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qemu-ga.c b/qemu-ga.c
index b747470..afd685e 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());
+    sprintf(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] qemu-ga: ga_open_pidfile(): add new line to pidfile
  2012-10-03 17:25 [Qemu-devel] [PATCH] qemu-ga: ga_open_pidfile(): add new line to pidfile Luiz Capitulino
@ 2012-10-03 20:24 ` Blue Swirl
  0 siblings, 0 replies; 2+ messages in thread
From: Blue Swirl @ 2012-10-03 20:24 UTC (permalink / raw)
  To: Luiz Capitulino; +Cc: mdroth, qemu-devel

On Wed, Oct 3, 2012 at 5:25 PM, Luiz Capitulino <lcapitulino@redhat.com> wrote:
> FHS dictates that pid files should end with a new line.
>
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
>  qemu-ga.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/qemu-ga.c b/qemu-ga.c
> index b747470..afd685e 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());
> +    sprintf(pidstr, "%d\n", getpid());

Please convert to snprintf() while at it.

>      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-03 20:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-03 17:25 [Qemu-devel] [PATCH] qemu-ga: ga_open_pidfile(): add new line to pidfile Luiz Capitulino
2012-10-03 20:24 ` Blue Swirl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.