Commit 771dc6c1 authored by Giovanni Campagna's avatar Giovanni Campagna Committed by Ray Strode

gsm-util: avoid overwriting a env variable with itself

This avoids a potentially thread-safety issue in our use of
gsm_util_setenv() to push locale variables to DBus.
parent a8f8c4fd
......@@ -497,10 +497,16 @@ gsm_util_setenv (const char *variable,
GError *bus_error;
if (!value)
g_unsetenv (variable);
g_setenv (variable, value, TRUE);
/* Note: we're intentionally comparing pointers here:
The goal is to avoid an un-threadsafe env variable update
when this API is used in maybe_push_env_var() in main.c
if (g_getenv (variable) != value) {
if (!value)
g_unsetenv (variable);
g_setenv (variable, value, TRUE);
bus_error = NULL;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment