X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibsystemd-bus%2Fbus-message.c;h=2d051e8aeb97fafeabf63f3e18ec11a689df7552;hb=23e97f7d9274b90fb0e1664945dc6259fdae6d39;hp=c7cc32ec15db8cb10f6bb0f7d55ba23b28ac75ee;hpb=27f6e5c7823f0b763a92d2938d222b900c5d70e6;p=elogind.git diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c index c7cc32ec1..2d051e8ae 100644 --- a/src/libsystemd-bus/bus-message.c +++ b/src/libsystemd-bus/bus-message.c @@ -302,6 +302,7 @@ int bus_message_from_malloc( m->n_iovec = 1; m->iovec[0].iov_base = buffer; m->iovec[0].iov_len = length; + m->size = length; r = message_parse_fields(m); if (r < 0) @@ -1240,7 +1241,7 @@ int sd_bus_message_close_container(sd_bus_message *m) { return 0; } -static int message_append_ap( +int bus_message_append_ap( sd_bus_message *m, const char *types, va_list ap) { @@ -1249,7 +1250,9 @@ static int message_append_ap( int r; assert(m); - assert(types); + + if (!types) + return 0; for (t = types; *t; t++) { switch (*t) { @@ -1326,7 +1329,7 @@ static int message_append_ap( n = va_arg(ap, unsigned); for (i = 0; i < n; i++) { - r = message_append_ap(m, s, ap); + r = bus_message_append_ap(m, s, ap); if (r < 0) return r; } @@ -1348,7 +1351,7 @@ static int message_append_ap( if (r < 0) return r; - r = message_append_ap(m, s, ap); + r = bus_message_append_ap(m, s, ap); if (r < 0) return r; @@ -1376,7 +1379,7 @@ static int message_append_ap( t += k - 1; - r = message_append_ap(m, s, ap); + r = bus_message_append_ap(m, s, ap); if (r < 0) return r; @@ -1406,10 +1409,10 @@ int sd_bus_message_append(sd_bus_message *m, const char *types, ...) { if (m->sealed) return -EPERM; if (!types) - return -EINVAL; + return 0; va_start(ap, types); - r = message_append_ap(m, types, ap); + r = bus_message_append_ap(m, types, ap); va_end(ap); return r;