diff options
author | Thomas Haller <thaller@redhat.com> | 2017-11-20 16:36:52 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-11-20 21:50:22 +0100 |
commit | 9998b5267a5cea41a24a3cca68f4707294882a82 (patch) | |
tree | dd361138d3fab63834fec1d700f6cf89e2c10ea9 | |
parent | 67f80df04f7f4a08f735782a9dfc7a367a9e8057 (diff) | |
download | network-manager-applet-9998b5267a5cea41a24a3cca68f4707294882a82.tar.gz |
applet: filter out G_MESSAGES_DEBUG from environment of auth-dialog
G_MESSAGES_DEBUG may enable additional debug messages on stdout.
That works badly with the auth-dialog -- which uses stdout to
communicate with the applet.
Note that the auth-dialog may use GTK, which in turn may print
additional debug messages to stdout.
-rw-r--r-- | src/applet-vpn-request.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/applet-vpn-request.c b/src/applet-vpn-request.c index c5311525..1bbe1d38 100644 --- a/src/applet-vpn-request.c +++ b/src/applet-vpn-request.c @@ -257,6 +257,8 @@ auth_dialog_spawn (const char *con_id, gsize hints_len; gsize i, j; gs_free const char **argv = NULL; + gs_free const char **envp = NULL; + gsize environ_len; g_return_val_if_fail (con_id, FALSE); g_return_val_if_fail (con_uuid, FALSE); @@ -287,9 +289,24 @@ auth_dialog_spawn (const char *con_id, nm_assert (i <= 10 + (2 * hints_len)); argv[i++] = NULL; + environ_len = NM_PTRARRAY_LEN (environ); + envp = g_new (const char *, environ_len + 1); + memcpy (envp, environ, sizeof (const char *) * environ_len); + for (i = 0, j = 0; i < environ_len; i++) { + const char *e = environ[i]; + + if (g_str_has_prefix (e, "G_MESSAGES_DEBUG=")) { + /* skip this environment variable. We interact with the auth-dialog via stdout. + * G_MESSAGES_DEBUG may enable additional debugging messages from GTK. */ + continue; + } + envp[j++] = e; + } + envp[j] = NULL; + if (!g_spawn_async_with_pipes (NULL, (char **) argv, - NULL, + (char **) envp, G_SPAWN_DO_NOT_REAP_CHILD, vpn_child_setup, NULL, |