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@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
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;
}
}