diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd-bus/sd-bus.c | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c index 342af4d1d5..542b5e8c49 100644 --- a/src/libsystemd-bus/sd-bus.c +++ b/src/libsystemd-bus/sd-bus.c @@ -3398,7 +3398,6 @@ int sd_bus_emit_signal( const char *types, ...) { _cleanup_bus_message_unref_ sd_bus_message *m = NULL; - va_list ap; int r; if (!bus) @@ -3412,11 +3411,15 @@ int sd_bus_emit_signal( if (r < 0) return r; - va_start(ap, types); - r = bus_message_append_ap(m, types, ap); - va_end(ap); - if (r < 0) - return r; + if (!isempty(types)) { + va_list ap; + + va_start(ap, types); + r = bus_message_append_ap(m, types, ap); + va_end(ap); + if (r < 0) + return r; + } return sd_bus_send(bus, m, NULL); } @@ -3432,7 +3435,6 @@ int sd_bus_call_method( const char *types, ...) { _cleanup_bus_message_unref_ sd_bus_message *m = NULL; - va_list ap; int r; if (!bus) @@ -3447,11 +3449,15 @@ int sd_bus_call_method( if (r < 0) return r; - va_start(ap, types); - r = bus_message_append_ap(m, types, ap); - va_end(ap); - if (r < 0) - return r; + if (!isempty(types)) { + va_list ap; + + va_start(ap, types); + r = bus_message_append_ap(m, types, ap); + va_end(ap); + if (r < 0) + return r; + } return sd_bus_send_with_reply_and_block(bus, m, 0, error, reply); } @@ -3462,7 +3468,6 @@ int sd_bus_reply_method_return( const char *types, ...) { _cleanup_bus_message_unref_ sd_bus_message *m = NULL; - va_list ap; int r; if (!bus) @@ -3485,11 +3490,15 @@ int sd_bus_reply_method_return( if (r < 0) return r; - va_start(ap, types); - r = bus_message_append_ap(m, types, ap); - va_end(ap); - if (r < 0) - return r; + if (!isempty(types)) { + va_list ap; + + va_start(ap, types); + r = bus_message_append_ap(m, types, ap); + va_end(ap); + if (r < 0) + return r; + } return sd_bus_send(bus, m, NULL); } |