summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd-bus/bus-message.c33
-rw-r--r--src/systemd/sd-bus.h1
2 files changed, 26 insertions, 8 deletions
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index 264a2f63f1..18c2d1c19d 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -2304,14 +2304,10 @@ int sd_bus_message_append_string_memfd(sd_bus_message *m, sd_memfd *memfd) {
void *a;
int r;
- if (!m)
- return -EINVAL;
- if (!memfd)
- return -EINVAL;
- if (m->sealed)
- return -EPERM;
- if (m->poisoned)
- return -ESTALE;
+ assert_return(m, -EINVAL);
+ assert_return(memfd, -EINVAL);
+ assert_return(!m->sealed, -EPERM);
+ assert_return(!m->poisoned, -ESTALE);
r = sd_memfd_set_sealed(memfd, true);
if (r < 0)
@@ -2376,6 +2372,27 @@ int sd_bus_message_append_string_memfd(sd_bus_message *m, sd_memfd *memfd) {
return 0;
}
+int sd_bus_message_append_strv(sd_bus_message *m, char **l) {
+ char **i;
+ int r;
+
+ assert_return(m, -EINVAL);
+ assert_return(!m->sealed, -EPERM);
+ assert_return(!m->poisoned, -ESTALE);
+
+ r = sd_bus_message_open_container(m, 'a', "s");
+ if (r < 0)
+ return r;
+
+ STRV_FOREACH(i, l) {
+ r = sd_bus_message_append_basic(m, 's', *i);
+ if (r < 0)
+ return r;
+ }
+
+ return sd_bus_message_close_container(m);
+}
+
int bus_body_part_map(struct bus_body_part *part) {
void *p;
size_t psz;
diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h
index bbeec1302a..e7ce56d7af 100644
--- a/src/systemd/sd-bus.h
+++ b/src/systemd/sd-bus.h
@@ -191,6 +191,7 @@ int sd_bus_message_append_array_space(sd_bus_message *m, char type, size_t size,
int sd_bus_message_append_array_memfd(sd_bus_message *m, char type, sd_memfd *memfd);
int sd_bus_message_append_string_space(sd_bus_message *m, size_t size, char **s);
int sd_bus_message_append_string_memfd(sd_bus_message *m, sd_memfd* memfd);
+int sd_bus_message_append_strv(sd_bus_message *m, char **l);
int sd_bus_message_open_container(sd_bus_message *m, char type, const char *contents);
int sd_bus_message_close_container(sd_bus_message *m);