From 542200f5393ae0923ce4693085cfe77902622778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Wed, 25 Nov 2015 10:51:44 +0100 Subject: [PATCH] clients: check errors of polkit_unix_session_new_for_process_sync() polkit_unix_session_new_for_process_sync() can fail. And calling polkit_agent_listener_register() with NULL PolkitSubject results in errors. https://bugzilla.gnome.org/show_bug.cgi?id=758625 --- clients/common/nm-polkit-listener.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/clients/common/nm-polkit-listener.c b/clients/common/nm-polkit-listener.c index 3f871b6323..9646374e9d 100644 --- a/clients/common/nm-polkit-listener.c +++ b/clients/common/nm-polkit-listener.c @@ -321,9 +321,11 @@ nm_polkit_listener_new (gboolean for_session, GError **error) listener = g_object_new (NM_TYPE_POLKIT_LISTENER, NULL); priv = NM_POLKIT_LISTENER_GET_PRIVATE (listener); - if (for_session) - session = polkit_unix_session_new_for_process_sync (getpid (), NULL, NULL); - else + if (for_session) { + session = polkit_unix_session_new_for_process_sync (getpid (), NULL, error); + if (!session) + return NULL; + } else session = polkit_unix_process_new_for_owner (getpid (), 0, getuid ()); priv->reg_handle = polkit_agent_listener_register (listener, POLKIT_AGENT_REGISTER_FLAGS_NONE,