chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Partially revert e62d8c394474
[elogind.git]
/
src
/
libsystemd-bus
/
bus-control.c
diff --git
a/src/libsystemd-bus/bus-control.c
b/src/libsystemd-bus/bus-control.c
index 50e1a2c00a64aa7940f7f0e264c30674a478b579..dd404442cf1c95658fa57b8e8776030c92f79842 100644
(file)
--- a/
src/libsystemd-bus/bus-control.c
+++ b/
src/libsystemd-bus/bus-control.c
@@
-27,12
+27,22
@@
#include "sd-bus.h"
#include "bus-internal.h"
#include "bus-message.h"
#include "sd-bus.h"
#include "bus-internal.h"
#include "bus-message.h"
+#include "bus-control.h"
+
+int sd_bus_get_unique_name(sd_bus *bus, const char **unique) {
+ int r;
-const char *sd_bus_get_unique_name(sd_bus *bus) {
if (!bus)
if (!bus)
- return NULL;
+ return -EINVAL;
+ if (!unique)
+ return -EINVAL;
+
+ r = bus_ensure_running(bus);
+ if (r < 0)
+ return r;
- return bus->unique_name;
+ *unique = bus->unique_name;
+ return 0;
}
int sd_bus_request_name(sd_bus *bus, const char *name, int flags) {
}
int sd_bus_request_name(sd_bus *bus, const char *name, int flags) {
@@
-59,7
+69,7
@@
int sd_bus_request_name(sd_bus *bus, const char *name, int flags) {
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;
@@
-94,7
+104,7
@@
int sd_bus_release_name(sd_bus *bus, const char *name) {
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;
@@
-135,11
+145,11
@@
int sd_bus_list_names(sd_bus *bus, char ***l) {
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;
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;
@@
-183,7
+193,7
@@
int sd_bus_get_owner(sd_bus *bus, const char *name, char **owner) {
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;
@@
-230,7
+240,7
@@
int sd_bus_get_owner_uid(sd_bus *bus, const char *name, uid_t *uid) {
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;
@@
-268,7
+278,7
@@
int sd_bus_get_owner_pid(sd_bus *bus, const char *name, pid_t *pid) {
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;
@@
-283,14
+293,12
@@
int sd_bus_get_owner_pid(sd_bus *bus, const char *name, pid_t *pid) {
return 0;
}
return 0;
}
-int
sd_bus_add_match
(sd_bus *bus, const char *match) {
+int
bus_add_match_internal
(sd_bus *bus, const char *match) {
_cleanup_bus_message_unref_ sd_bus_message *m = NULL, *reply = NULL;
int r;
_cleanup_bus_message_unref_ sd_bus_message *m = NULL, *reply = NULL;
int r;
- if (!bus)
- return -EINVAL;
- if (!match)
- return -EINVAL;
+ assert(bus);
+ assert(match);
r = sd_bus_message_new_method_call(
bus,
r = sd_bus_message_new_method_call(
bus,
@@
-306,17
+314,15
@@
int sd_bus_add_match(sd_bus *bus, const char *match) {
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) {
+int
bus_remove_match_internal
(sd_bus *bus, const char *match) {
_cleanup_bus_message_unref_ sd_bus_message *m = NULL, *reply = NULL;
int r;
_cleanup_bus_message_unref_ sd_bus_message *m = NULL, *reply = NULL;
int r;
- if (!bus)
- return -EINVAL;
- if (!match)
- return -EINVAL;
+ assert(bus);
+ assert(match);
r = sd_bus_message_new_method_call(
bus,
r = sd_bus_message_new_method_call(
bus,
@@
-332,5
+338,5
@@
int sd_bus_remove_match(sd_bus *bus, const char *match) {
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);
}
}