summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2018-03-07 13:32:07 +0100
committerRalf Habacker <ralf.habacker@freenet.de>2018-03-21 12:29:07 +0100
commit5a1f99d95896ce43daf92b49d990de7544b69168 (patch)
treee778ab0fb8df38ee8dc3e2024b98d67d14e155d1
parent3be965776fcb533e125d7e728f5b3a20a0eec594 (diff)
Fix dbus-send not returning an error exit code in case an error occured and --print-reply is not set99751-auto-shutdown
-rw-r--r--doc/dbus-send.1.xml.in8
-rw-r--r--tools/dbus-send.c15
2 files changed, 14 insertions, 9 deletions
diff --git a/doc/dbus-send.1.xml.in b/doc/dbus-send.1.xml.in
index 271435ca3..91ee3bc65 100644
--- a/doc/dbus-send.1.xml.in
+++ b/doc/dbus-send.1.xml.in
@@ -152,6 +152,14 @@ The default is implementation&hyphen;defined, typically 25 seconds.</para>
</variablelist>
</refsect1>
+<refsect1 id="exit_status">
+ <title>EXIT STATUS</title>
+ <para>
+ <command>dbus-send</command>
+ 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.</para>
+</refsect1>
+
<refsect1 id='author'><title>AUTHOR</title>
<para>dbus-send was written by Philip Blundell.</para>
diff --git a/tools/dbus-send.c b/tools/dbus-send.c
index 6fb65fe05..63c926899 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);