diff options
Diffstat (limited to 'src/libsystemd-bus/bus-message.c')
-rw-r--r-- | src/libsystemd-bus/bus-message.c | 20 |
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; |