On 08/19/13 12:45, Daniel P. Berrange wrote: > On Mon, Aug 19, 2013 at 12:32:05PM +0200, Peter Krempa wrote: >> Some systems may not use DBus in their system. Add a method to check if >> the system bus is available that doesn't print error messages so that >> code can later check for this condition and use an alternative approach. >> --- >> src/libvirt_private.syms | 1 + >> src/util/virdbus.c | 34 +++++++++++++++++++++++++++++++--- >> src/util/virdbus.h | 1 + >> 3 files changed, 33 insertions(+), 3 deletions(-) .... >> >> DBusConnection *virDBusGetSystemBus(void); >> +DBusConnection *virDBusHasSystemBus(void); > > This should be a returning a 'bool' IMHO. eg usage would be > > > if (virDBusHasSystemBus()) { > DBusConnection conn = virDBusGetSystemBus() > ....dbus code path... > } else { > ... non-dbus code path... > } That was my initial implementation but it resulted in a few more lines of code. I'll repost with that changed. Peter
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list