]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
update-activation-environment: produce better diagnostics on error
authorSimon McVittie <smcv@debian.org>
Mon, 11 Jul 2016 09:52:44 +0000 (10:52 +0100)
committerSimon McVittie <smcv@debian.org>
Fri, 12 Aug 2016 08:50:00 +0000 (09:50 +0100)
If dbus-daemon or systemd replied to our method call with an error,
we would report it as "invalid arguments" instead of the true error
name and message.

Same root cause as <https://bugs.freedesktop.org/show_bug.cgi?id=96653>.

Signed-off-by: Simon McVittie <smcv@debian.org>
tools/dbus-update-activation-environment.c

index 6c53d8e20bac17cbbb2969edf0d35a714d47083a..160ac5d0ae50017a9520eeebc6bbd66d24b2837f 100644 (file)
@@ -378,7 +378,8 @@ next:
       exit (EX_UNAVAILABLE);
     }
 
-  if (!dbus_message_get_args (msg, &error, DBUS_TYPE_INVALID))
+  if (dbus_set_error_from_message (&error, msg) ||
+      !dbus_message_get_args (msg, &error, DBUS_TYPE_INVALID))
     {
       fprintf (stderr,
           "%s: error from dbus-daemon: %s: %s\n",
@@ -402,7 +403,8 @@ next:
               "%s: warning: error sending to systemd: %s: %s\n",
               PROGNAME, error.name, error.message);
         }
-      else if (!dbus_message_get_args (msg, &error, DBUS_TYPE_INVALID))
+      else if (dbus_set_error_from_message (&error, msg) ||
+          !dbus_message_get_args (msg, &error, DBUS_TYPE_INVALID))
         {
           fprintf (stderr,
               "%s: warning: error from systemd: %s: %s\n",