Merge pull request #8739 from yuwata/add-description

bus-util: introduce bus_open_system_watch_bind_with_description()
This commit is contained in:
Lennart Poettering 2018-04-17 20:33:50 +02:00 committed by GitHub
commit 3ac2e8fe17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 4 deletions

View File

@ -131,7 +131,7 @@ int manager_connect_bus(Manager *m) {
if (m->bus)
return 0;
r = bus_open_system_watch_bind(&m->bus);
r = bus_open_system_watch_bind_with_description(&m->bus, "bus-api-network");
if (r < 0)
return log_error_errno(r, "Failed to connect to bus: %m");

View File

@ -1883,7 +1883,7 @@ int manager_connect_bus(Manager *m) {
if (m->bus)
return 0;
r = bus_open_system_watch_bind(&m->bus);
r = bus_open_system_watch_bind_with_description(&m->bus, "bus-api-resolve");
if (r < 0)
return log_error_errno(r, "Failed to connect to system bus: %m");

View File

@ -1657,7 +1657,7 @@ int bus_track_add_name_many(sd_bus_track *t, char **l) {
return r;
}
int bus_open_system_watch_bind(sd_bus **ret) {
int bus_open_system_watch_bind_with_description(sd_bus **ret, const char *description) {
_cleanup_(sd_bus_unrefp) sd_bus *bus = NULL;
const char *e;
int r;
@ -1670,6 +1670,12 @@ int bus_open_system_watch_bind(sd_bus **ret) {
if (r < 0)
return r;
if (description) {
r = sd_bus_set_description(bus, description);
if (r < 0)
return r;
}
e = secure_getenv("DBUS_SYSTEM_BUS_ADDRESS");
if (!e)
e = DEFAULT_SYSTEM_BUS_ADDRESS;

View File

@ -159,4 +159,7 @@ int bus_property_get_rlimit(sd_bus *bus, const char *path, const char *interface
int bus_track_add_name_many(sd_bus_track *t, char **l);
int bus_open_system_watch_bind(sd_bus **ret);
int bus_open_system_watch_bind_with_description(sd_bus **ret, const char *description);
static inline int bus_open_system_watch_bind(sd_bus **ret) {
return bus_open_system_watch_bind_with_description(ret, NULL);
}