diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2021-03-05 02:33:59 +0000 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-03-06 12:40:20 +0000 |
commit | cff3a1c08d6773410221717015cf9e051c4c7fe4 (patch) | |
tree | 7fab0c27f7d071e7f90cabbe5f4dedde5fda4b12 /epan/prefs.c | |
parent | e4b5573ff5b4343ea24524206ecc70bc17aa7664 (diff) |
prefs: Don't clobber env variable G_MESSAGES_DEBUG
Avoid silently overwriting the user's configuration.
Ping #17271.
Diffstat (limited to 'epan/prefs.c')
-rw-r--r-- | epan/prefs.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/epan/prefs.c b/epan/prefs.c index 6379db9fd5..0e37eedb33 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -2445,11 +2445,20 @@ console_log_level_set_cb(pref_t* pref, const gchar* value, unsigned int* changed } if (*pref->varp.uint & (G_LOG_LEVEL_INFO|G_LOG_LEVEL_DEBUG)) { - /* - * GLib >= 2.32 drops INFO and DEBUG messages by default. Tell - * it not to do that. - */ - g_setenv("G_MESSAGES_DEBUG", "all", TRUE); + /* + * GLib drops INFO and DEBUG messages by default. If the user + * hasn't set G_MESSAGES_DEBUG, possibly to a specific set of + * domains, tell it not to do that. + */ + const char *s = g_getenv("G_MESSAGES_DEBUG"); + if(s != NULL) { + g_message("prefs: Skip overwriting environment variable " + "G_MESSAGES_DEBUG=\"%s\"", s); + } + else { + g_info("prefs: Set environment variable G_MESSAGES_DEBUG=\"all\""); + g_setenv("G_MESSAGES_DEBUG", "all", FALSE); + } } return PREFS_SET_OK; |