summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/sd-bus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-10-11 05:20:24 +0200
committerLennart Poettering <lennart@poettering.net>2013-10-11 05:20:24 +0200
commit5a037827f61a2e78f3863bc5a08f1535882d7f6a (patch)
treee3968b86c6196a18b8ae0012b4d4960e52150960 /src/libsystemd-bus/sd-bus.c
parent5d12cc3e286c8515f18c8417d67e26e4e2b2e7cb (diff)
bus: allow specifying NULL as type string when we want to construct messages with no payload
Diffstat (limited to 'src/libsystemd-bus/sd-bus.c')
-rw-r--r--src/libsystemd-bus/sd-bus.c45
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);
}