[PATCH] Fix virsystemdtest without SYSTEMD_DAEMON

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit 4897698 fixed the build without dbus by only building
the virSystemdPMSupportTarget with SYSTEMD_DAEMON.

Introduce a virDBusMessageUnref wrapper for dbus_message_unref
to let virsystemd.c build without dbus, while still allowing
virsystemdtest to run without SYSTEM_DAEMON.
---
 src/util/virdbus.c    |  9 +++++++++
 src/util/virdbus.h    |  1 +
 src/util/virsystemd.c | 11 +----------
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/util/virdbus.c b/src/util/virdbus.c
index 0cd3858..4217aea 100644
--- a/src/util/virdbus.c
+++ b/src/util/virdbus.c
@@ -1614,6 +1614,11 @@ int virDBusIsServiceRegistered(const char *name)
     return ret;
 }
 
+void virDBusMessageUnref(DBusMessage *msg)
+{
+    dbus_message_unref(msg);
+}
+
 #else /* ! WITH_DBUS */
 void virDBusSetSharedBus(bool shared ATTRIBUTE_UNUSED)
 {
@@ -1751,4 +1756,8 @@ int virDBusIsServiceRegistered(const char *name ATTRIBUTE_UNUSED)
     return -2;
 }
 
+void virDBusMessageUnref(DBusMessage *msg ATTRIBUTE_UNUSED)
+{
+    /* nothing */
+}
 #endif /* ! WITH_DBUS */
diff --git a/src/util/virdbus.h b/src/util/virdbus.h
index 0f21821..a4987b8 100644
--- a/src/util/virdbus.h
+++ b/src/util/virdbus.h
@@ -74,6 +74,7 @@ int virDBusCall(DBusConnection *conn,
                 DBusError *error);
 int virDBusMessageRead(DBusMessage *msg,
                        const char *types, ...);
+void virDBusMessageUnref(DBusMessage *msg);
 
 int virDBusIsServiceEnabled(const char *name);
 int virDBusIsServiceRegistered(const char *name);
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index e67956f..ad15a18 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -326,7 +326,6 @@ virSystemdNotifyStartup(void)
 #endif
 }
 
-#ifdef WITH_SYSTEMD_DAEMON
 static int
 virSystemdPMSupportTarget(const char *methodName, bool *result)
 {
@@ -365,19 +364,11 @@ virSystemdPMSupportTarget(const char *methodName, bool *result)
     ret = 0;
 
  cleanup:
-    dbus_message_unref(message);
+    virDBusMessageUnref(message);
     VIR_FREE(response);
 
     return ret;
 }
-#else /* ! WITH_SYSTEMD_DAEMON */
-static int
-virSystemdPMSupportTarget(const char *methodName ATTRIBUTE_UNUSED,
-                          bool *result ATTRIBUTE_UNUSED)
-{
-    return -2;
-}
-#endif /* ! WITH_SYSTEMD_DAEMON */
 
 int virSystemdCanSuspend(bool *result)
 {
-- 
1.8.3.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]