#include "bus-internal.h"
#include "bus-message.h"
-const char *sd_bus_get_unique_name(sd_bus *bus) {
+int sd_bus_get_unique_name(sd_bus *bus, const char **unique) {
+ int r;
+
if (!bus)
- return NULL;
+ return -EINVAL;
+ if (!unique)
+ return -EINVAL;
- return bus->unique_name;
+ r = bus_ensure_running(bus);
+ if (r < 0)
+ return r;
+
+ *unique = bus->unique_name;
+ return 0;
}
int sd_bus_request_name(sd_bus *bus, const char *name, int flags) {
if (r < 0)
return r;
- r = sd_bus_send_with_reply_and_block(bus, m, (uint64_t) -1, NULL, &reply);
+ r = sd_bus_send_with_reply_and_block(bus, m, 0, NULL, &reply);
if (r < 0)
return r;
if (r < 0)
return r;
- r = sd_bus_send_with_reply_and_block(bus, m, (uint64_t) -1, NULL, &reply);
+ r = sd_bus_send_with_reply_and_block(bus, m, 0, NULL, &reply);
if (r < 0)
return r;
if (r < 0)
return r;
- r = sd_bus_send_with_reply_and_block(bus, m1, (uint64_t) -1, NULL, &reply1);
+ r = sd_bus_send_with_reply_and_block(bus, m1, 0, NULL, &reply1);
if (r < 0)
return r;
- r = sd_bus_send_with_reply_and_block(bus, m2, (uint64_t) -1, NULL, &reply2);
+ r = sd_bus_send_with_reply_and_block(bus, m2, 0, NULL, &reply2);
if (r < 0)
return r;
if (r < 0)
return r;
- r = sd_bus_send_with_reply_and_block(bus, m, (uint64_t) -1, NULL, &reply);
+ r = sd_bus_send_with_reply_and_block(bus, m, 0, NULL, &reply);
if (r < 0)
return r;
if (r < 0)
return r;
- r = sd_bus_send_with_reply_and_block(bus, m, (uint64_t) -1, NULL, &reply);
+ r = sd_bus_send_with_reply_and_block(bus, m, 0, NULL, &reply);
if (r < 0)
return r;
if (r < 0)
return r;
- r = sd_bus_send_with_reply_and_block(bus, m, (uint64_t) -1, NULL, &reply);
+ r = sd_bus_send_with_reply_and_block(bus, m, 0, NULL, &reply);
if (r < 0)
return r;
if (r < 0)
return r;
- return sd_bus_send_with_reply_and_block(bus, m, (uint64_t) -1, NULL, &reply);
+ return sd_bus_send_with_reply_and_block(bus, m, 0, NULL, &reply);
}
int sd_bus_remove_match(sd_bus *bus, const char *match) {
if (r < 0)
return r;
- return sd_bus_send_with_reply_and_block(bus, m, (uint64_t) -1, NULL, &reply);
+ return sd_bus_send_with_reply_and_block(bus, m, 0, NULL, &reply);
}