From a7f2b61cdf00e90e702cb69f88ec93088c5e9536 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 6 Jun 2008 19:28:53 +0000 Subject: [PATCH] 2008-06-06 Dan Williams * system-settings/src/nm-polkit-helpers.c - (create_polkit_context): in PolicyKit 0.6, polkit_context_init() will unref the context if the initialization fails; also avoid spew when the error isn't set git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3731 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 7 +++++++ system-settings/src/nm-polkit-helpers.c | 9 +++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 006db9783e..f41bdca04f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-06-06 Dan Williams + + * system-settings/src/nm-polkit-helpers.c + - (create_polkit_context): in PolicyKit 0.6, polkit_context_init() will + unref the context if the initialization fails; also avoid spew when + the error isn't set + 2008-06-06 Dan Williams Patch from Tambet Ingo diff --git a/system-settings/src/nm-polkit-helpers.c b/system-settings/src/nm-polkit-helpers.c index 7ac336c807..3858d01b1f 100644 --- a/system-settings/src/nm-polkit-helpers.c +++ b/system-settings/src/nm-polkit-helpers.c @@ -86,10 +86,15 @@ create_polkit_context (void) polkit_context_set_io_watch_functions (global_context, pk_io_add_watch, pk_io_remove_watch); err = NULL; if (!polkit_context_init (global_context, &err)) { - g_warning ("Cannot initialize libpolkit: %s", polkit_error_get_error_message (err)); - polkit_error_free (err); + g_warning ("Cannot initialize libpolkit: %s", + err ? polkit_error_get_error_message (err) : "unknown error"); + if (err) + polkit_error_free (err); + /* PK 0.6's polkit_context_init() unrefs the global_context on failure */ +#if (POLKIT_VERSION_MAJOR == 0) && (POLKIT_VERSION_MINOR >= 7) polkit_context_unref (global_context); +#endif global_context = NULL; }