pokit-agent: fix segfault when we we fail to get the current session

When using systemd, polkit doesn't set the error even when returning false in g_initable_init

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>

https://bugzilla.gnome.org/show_bug.cgi?id=670319
This commit is contained in:
Marc-Antoine Perennou 2012-02-17 20:48:25 +01:00
parent 0e5177c329
commit b67138b5ae

View File

@ -107,12 +107,19 @@ shell_polkit_authentication_agent_init (ShellPolkitAuthenticationAgent *agent)
NULL, /* GCancellable* */ NULL, /* GCancellable* */
&error); &error);
if (subject == NULL) if (subject == NULL)
{
if (error) /* polkit version 104 and older don't properly set error on failure */
{ {
g_warning ("Error getting session for the process we are in: %s (%s %d)", g_warning ("Error getting session for the process we are in: %s (%s %d)",
error->message, error->message,
g_quark_to_string (error->domain), g_quark_to_string (error->domain),
error->code); error->code);
g_error_free (error); g_error_free (error);
}
else
{
g_warning ("Error getting session for the process we are in");
}
goto out; goto out;
} }