Match *first;
first = hashmap_get(m->client->matches, m->match);
- LIST_REMOVE(matches, first, m);
- if (first)
+ if (first) {
+ LIST_REMOVE(matches, first, m);
assert_se(hashmap_replace(m->client->matches, m->match, first) >= 0);
- else
+ } else
hashmap_remove(m->client->matches, m->match);
m->client->n_matches--;
m = hashmap_get(c->matches, normalized);
if (!m) {
- r = sd_bus_error_setf(error, SD_BUS_ERROR_MATCH_RULE_NOT_FOUND, "Match rule \"%s\" not found.");
+ r = sd_bus_error_setf(error, SD_BUS_ERROR_MATCH_RULE_NOT_FOUND, "Match rule \"%s\" not found.", normalized);
goto finish;
}
if (!streq(name->name, arg0))
continue;
- if (asprintf(&n, ":1.%llu", (unsigned long long) name->id) < 0)
+ if (asprintf(&n, ":1.%llu", (unsigned long long) name->owner_id) < 0)
return -ENOMEM;
r = strv_push(&owners, n);
if (r < 0)
return r;
- n->id = id;
+ n->owner_id = id;
r = ioctl(bus->input_fd, KDBUS_CMD_NAME_ACQUIRE, n);
if (r < 0) {
if (r < 0)
return r;
- n->id = id;
+ n->owner_id = id;
r = ioctl(bus->input_fd, KDBUS_CMD_NAME_RELEASE, n);
if (r < 0) {
if (r < 0)
return r;
- if (!t[0] || t[1])
- return -EIO;
+ if (!t || !t[0] || t[1])
+ return sd_bus_error_setf(error, SD_BUS_ERROR_SERVICE_UNKNOWN, "Bus name %s not found.", name);
r = sd_bus_call_method(
bus,
r = sd_bus_request_name(c->bus, "org.freedesktop.DBus", 0);
if (r < 0) {
- log_error("Unable to request name: %s\n", strerror(-r));
+ log_error("Unable to request name: %s", strerror(-r));
return r;
}