From bdbbb9832cbec9e5990963ed93fc3426b616496d Mon Sep 17 00:00:00 2001
Message-Id: <bdbbb9832cbec9e5990963ed93fc3426b616496d.1350045285.git.minovotn@redhat.com>
In-Reply-To: <8d140e6fe679a73fd193609be44d508f17f7892b.1350045285.git.minovotn@redhat.com>
References: <8d140e6fe679a73fd193609be44d508f17f7892b.1350045285.git.minovotn@redhat.com>
From: Luiz Capitulino <lcapitulino@redhat.com>
Date: Tue, 9 Oct 2012 14:34:29 +0200
Subject: [PATCH 03/12] qemu-ga: use state dir from CONFIG_QEMU_LOCALSTATEDIR

RH-Author: Luiz Capitulino <lcapitulino@redhat.com>
Message-id: <1349793271-23645-4-git-send-email-lcapitulino@redhat.com>
Patchwork-id: 42853
O-Subject: [RHEL6.4 qemu-kvm PATCH 3/5] qemu-ga: use state dir from CONFIG_QEMU_LOCALSTATEDIR
Bugzilla: 856422
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>

Has the side effect of changing the default directory used to
save the freeze status file from /tmp to ${prefix}/var/run.

This is a beneficial change for two reasons:

  1. FHS states that programs must not assume that files in /tmp will
     still exist between invocations of the program. This defeats
	 the purpose of the freeze status file

  2. FHS dictates that /var/run must be cleaned on boot, this
     ensures that a stale freeze status file will be removed on boot

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 qemu-ga.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 qemu-ga.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/qemu-ga.c b/qemu-ga.c
index 42e271f..36051b9 100644
--- a/qemu-ga.c
+++ b/qemu-ga.c
@@ -41,8 +41,8 @@
 #else
 #define QGA_VIRTIO_PATH_DEFAULT "\\\\.\\Global\\org.qemu.guest_agent.0"
 #endif
-#define QGA_PIDFILE_DEFAULT "/var/run/qemu-ga.pid"
-#define QGA_STATEDIR_DEFAULT "/tmp"
+#define QGA_STATEDIR_DEFAULT CONFIG_QEMU_LOCALSTATEDIR "/run"
+#define QGA_PIDFILE_DEFAULT QGA_STATEDIR_DEFAULT "/qemu-ga.pid"
 #define QGA_SENTINEL_BYTE 0xFF
 
 struct GAState {
-- 
1.7.11.7

