Allow nwfilterDriverRemoveDBusMatches to be called without
nwfilterDriverInstallDBusMatches being called previously.
This enables a later patch to use nwfilterDriverRemoveDBusMatches
as a cleanup function safely.
Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/nwfilter/nwfilter_driver.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index 1f7d40e1b0..f89b5b8757 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -77,12 +77,19 @@ static unsigned int reloadID;
static void
nwfilterDriverRemoveDBusMatches(void)
{
- GDBusConnection *sysbus;
+ GDBusConnection *sysbus = virGDBusGetSystemBus();
- sysbus = virGDBusGetSystemBus();
- if (sysbus) {
+ if (!sysbus)
+ return;
+
+ if (restartID != 0) {
g_dbus_connection_signal_unsubscribe(sysbus, restartID);
+ restartID = 0;
+ }
+
+ if (reloadID != 0) {
g_dbus_connection_signal_unsubscribe(sysbus, reloadID);
+ reloadID = 0;
}
}
--
2.31.1