+}
+
diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c
-index 28de744..9bc0cc1 100644
+index 28de744..cc6a47f 100644
--- a/tools/xenpmd/xenpmd.c
+++ b/tools/xenpmd/xenpmd.c
@@ -40,10 +40,11 @@
/* Borrowed daemonize from xenstored - Initially written by Stevens. */
static void daemonize(void)
{
-@@ -493,24 +513,57 @@ static void daemonize(void)
+@@ -493,24 +513,56 @@ static void daemonize(void)
umask(0);
}
+ if ( xs == NULL )
+ return NULL;
+
-+ if ( write_one_time_battery_info() == 0 )
+ initialize_system_state_info();
+ monitor_acpi_events();
+ if ( write_one_time_battery_info() == 0 )