summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus
diff options
context:
space:
mode:
authorMarc-Antoine Perennou <Marc-Antoine@Perennou.com>2013-11-05 21:42:25 +0900
committerLennart Poettering <lennart@poettering.net>2013-11-05 18:12:18 +0100
commit4686d1b6ee73f1e0cea25f621561b668aa2d6651 (patch)
tree9e859c285f28ff4db660c2133c32e2d13b940077 /src/libsystemd-bus
parentb3451bed41453304735b68726571d49fb676d466 (diff)
bus: add sd_bus_message_read_strv()
It will be useful to have that in the public API.
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r--src/libsystemd-bus/bus-message.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index 7a4c65d689..96d1778235 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -4486,7 +4486,7 @@ int bus_message_read_strv_extend(sd_bus_message *m, char ***l) {
assert(l);
r = sd_bus_message_enter_container(m, 'a', "s");
- if (r < 0)
+ if (r <= 0)
return r;
for (;;) {
@@ -4510,6 +4510,24 @@ int bus_message_read_strv_extend(sd_bus_message *m, char ***l) {
return 0;
}
+int sd_bus_message_read_strv(sd_bus_message *m, char ***l) {
+ char **strv = NULL;
+ int r;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->sealed, -EPERM);
+ assert_return(l, -EINVAL);
+
+ r = bus_message_read_strv_extend(m, &strv);
+ if (r <= 0) {
+ strv_free(strv);
+ return r;
+ }
+
+ *l = strv;
+ return 1;
+}
+
const char* bus_message_get_arg(sd_bus_message *m, unsigned i) {
int r;
const char *t = NULL;