dbus: propagate errors from bus_init_system() and bus_init_api()
authorMichal Sekletar <msekleta@redhat.com>
Wed, 10 Jan 2018 16:22:12 +0000 (17:22 +0100)
committerMichal Sekletar <msekleta@redhat.com>
Thu, 11 Jan 2018 13:41:34 +0000 (14:41 +0100)
commitdc7118ba094415d8de3812881cc5cbe2e3cac73e
tree87d41afde7ece6977c148bee1e2d84d496fcd0fd
parent1f1580139ed48dd308a6a2470baf037ae1ed6aab
dbus: propagate errors from bus_init_system() and bus_init_api()

The aim of this change is to make sure that we properly log about all
D-Bus connection problems. After all, we only ever attempt to get on the
bus if dbus-daemon is around, so any failure in the process should be
treated as an error.

bus_init_system() is only called from bus_init() and in
bus_init() we have a bool flag which governs whether we should attempt
to connect to the system bus or not.
Hence if we are in bus_init_system() then it is clear we got called from
a context where connection to the bus is actually required and therefore
shouldn't be treated as the "best effort" type of operation. Same
applies to bus_init_api().

We make use of those error codes in bus_init() and log high level
message that informs admin about what is going on (and is easy to spot
and makes sense to an end user).

Also "retrying later" bit is actually a lie. We won't retry unless we
are explicitly told to reconnect via SIGUSR1 or re-executed. This is
because bus_init() is always called from the context where dbus-daemon
is already around and hence bus_init() won't be called again from
unit_notify().

Fixes #7782
src/core/dbus.c