throw_error(): Print error to stderr when being called internally
authorMartin Pitt <martin.pitt@ubuntu.com>
Sun, 3 Apr 2011 20:55:26 +0000 (22:55 +0200)
committerMartin Pitt <martin.pitt@ubuntu.com>
Sun, 3 Apr 2011 22:10:23 +0000 (00:10 +0200)
throw_error() immediately returns for Device methods which are called
internally from the daemon (i. e. without an actual PolicyKit check), as we do
not have a D-BUS invocation context. Print out the error message in this case
as well.

src/device.c

index 261e45e..14d323a 100644 (file)
@@ -5281,13 +5281,16 @@ throw_error (DBusGMethodInvocation *context,
   va_list args;
   char *message;
 
-  if (context == NULL)
-    return TRUE;
-
   va_start (args, format);
   message = g_strdup_vprintf (format, args);
   va_end (args);
 
+  if (context == NULL)
+    {
+      g_warning ("%s", message);
+      return TRUE;
+    }
+
   error = g_error_new (ERROR, error_code, "%s", message);
   dbus_g_method_return_error (context, error);
   g_error_free (error);