diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2022-12-01 18:43:38 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2022-12-06 18:36:15 +0000 |
| commit | ccfb953bb020a1d229490b8a3e7790ed5c7e1752 (patch) | |
| tree | 6aa0147074815d1c2caebccd76a4e09e38ecd022 /slave.c | |
| parent | doc: foot.ini: add example, and mention string options can be quoted (diff) | |
slave: unsetenv() env vars that have been set to the empty string
That is, users can now *clear* environment variables by doing:
[environment]
VAR=””
Note that the quotes are required.
Closes #1225
Diffstat (limited to 'slave.c')
| -rw-r--r-- | slave.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -359,8 +359,15 @@ slave_spawn(int ptmx, int argc, const char *cwd, char *const *argv, #endif if (extra_env_vars != NULL) { - tll_foreach(*extra_env_vars, it) - setenv(it->item.name, it->item.value, 1); + tll_foreach(*extra_env_vars, it) { + const char *name = it->item.name; + const char *value = it->item.value; + + if (strlen(value) == 0) + unsetenv(name); + else + setenv(name, value, 1); + } } char **_shell_argv = NULL; |
