diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2022-02-09 10:25:54 +1300 |
---|---|---|
committer | Robert Ancell <robert.ancell@gmail.com> | 2022-06-27 11:46:01 +1200 |
commit | 35326597c2f5d1e42c56feaf7f8aedac9c9d14ff (patch) | |
tree | b8f54c7d51eb14c707b4fbf5d41416d04d313b36 | |
parent | 756d2323ad615e0ec98fa273c611de7b07ee2ca5 (diff) | |
download | lightdm-git-35326597c2f5d1e42c56feaf7f8aedac9c9d14ff.tar.gz |
Don't call setenv with a NULL value - the behaviour is undefined.
-rw-r--r-- | src/process.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/process.c b/src/process.c index d25c909b..aa614d36 100644 --- a/src/process.c +++ b/src/process.c @@ -248,7 +248,13 @@ process_start (Process *process, gboolean block) environ = NULL; #endif for (guint i = 0; i < env_length; i++) - setenv (env_keys[i], env_values[i], TRUE); + { + const gchar *value = env_values[i]; + if (value != NULL) + setenv (env_keys[i], value, TRUE); + else + unsetenv (env_keys[i]); + } /* Reset SIGPIPE handler so the child has default behaviour (we disabled it at LightDM start) */ signal (SIGPIPE, SIG_DFL); |