mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 08:48:07 +02:00
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
(cherry picked from commit 542200f539)
This commit is contained in:
parent
be8619261d
commit
c7cb2e8c1c
1 changed files with 5 additions and 3 deletions
|
|
@ -323,9 +323,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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue