int bus_start_running(sd_bus *bus) {
struct reply_callback *c;
- Iterator i;
usec_t n;
int r;
* adding a fixed value to all entries should not alter the internal order. */
n = now(CLOCK_MONOTONIC);
- ORDERED_HASHMAP_FOREACH(c, bus->reply_callbacks, i) {
+ ORDERED_HASHMAP_FOREACH(c, bus->reply_callbacks) {
if (c->timeout_usec == 0)
continue;
int bus_set_address_system(sd_bus *b) {
const char *e;
+ int r;
+
assert(b);
e = secure_getenv("DBUS_SYSTEM_BUS_ADDRESS");
- return sd_bus_set_address(b, e ?: DEFAULT_SYSTEM_BUS_ADDRESS);
+
+ r = sd_bus_set_address(b, e ?: DEFAULT_SYSTEM_BUS_ADDRESS);
+ if (r >= 0)
+ b->is_system = true;
+ return r;
}
_public_ int sd_bus_open_system_with_description(sd_bus **ret, const char *description) {
return r;
b->bus_client = true;
- b->is_system = true;
/* Let's do per-method access control on the system bus. We
* need the caller's UID and capability set for that. */
int bus_set_address_user(sd_bus *b) {
const char *a;
_cleanup_free_ char *_a = NULL;
+ int r;
assert(b);
a = _a;
}
- return sd_bus_set_address(b, a);
+ r = sd_bus_set_address(b, a);
+ if (r >= 0)
+ b->is_user = true;
+ return r;
}
_public_ int sd_bus_open_user_with_description(sd_bus **ret, const char *description) {
return r;
b->bus_client = true;
- b->is_user = true;
/* We don't do any per-method access control on the user bus. */
b->trusted = true;
r = ppoll(p, n, m == USEC_INFINITY ? NULL : timespec_store(&ts, m), NULL);
if (r < 0)
return -errno;
+ if (r == 0)
+ return 0;
- return r > 0 ? 1 : 0;
+ if (p[0].revents & POLLNVAL)
+ return -EBADF;
+ if (n >= 2 && (p[1].revents & POLLNVAL))
+ return -EBADF;
+
+ return 1;
}
_public_ int sd_bus_wait(sd_bus *bus, uint64_t timeout_usec) {