From 6f7f2194798af180a178010471642361fad45435 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Wed, 7 Mar 2018 13:32:07 +0100 Subject: [PATCH] Fix dbus-send not returning an error exit code in case an error occured and --print-reply is not set https://bugs.freedesktop.org/show_bug.cgi?id=105380 --- doc/dbus-send.1.xml.in | 8 ++++++++ tools/dbus-send.c | 15 ++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/doc/dbus-send.1.xml.in b/doc/dbus-send.1.xml.in index 271435ca..91ee3bc6 100644 --- a/doc/dbus-send.1.xml.in +++ b/doc/dbus-send.1.xml.in @@ -152,6 +152,14 @@ The default is implementation‐defined, typically 25 seconds. + + EXIT STATUS + + dbus-send + exits with status 0 on success and status 1 in case of errors. + In the error case a related message will be printed to stderr. + + AUTHOR dbus-send was written by Philip Blundell. diff --git a/tools/dbus-send.c b/tools/dbus-send.c index 6fb65fe0..63c92689 100644 --- a/tools/dbus-send.c +++ b/tools/dbus-send.c @@ -579,7 +579,6 @@ main (int argc, char *argv[]) } } - if (print_reply) { DBusMessage *reply; @@ -597,18 +596,16 @@ main (int argc, char *argv[]) if (reply) { - long sec, usec; + if (print_reply) + { + long sec, usec; - _dbus_get_real_time (&sec, &usec); - print_message (reply, print_reply_literal, sec, usec); + _dbus_get_real_time (&sec, &usec); + print_message (reply, print_reply_literal, sec, usec); + } dbus_message_unref (reply); } } - else - { - dbus_connection_send (connection, message, NULL); - dbus_connection_flush (connection); - } dbus_message_unref (message); -- 2.12.3