summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-02-10 19:18:54 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-02-10 19:18:54 +0000
commitdd478a768bce79bcf6c627310e2ddb473667fecc (patch)
treebbdb160af2b5ac822ffc0572304b17ea9b0818f8 /src
parent540cefac9d8e663dfb3ad69b0bb806a9ba5e88b4 (diff)
downloadskalibs-dd478a768bce79bcf6c627310e2ddb473667fecc.tar.xz
bugfix: env_merge didn't correctly handle variable removal
Diffstat (limited to 'src')
-rw-r--r--src/libstddjb/env_merge.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstddjb/env_merge.c b/src/libstddjb/env_merge.c
index 9129cf3..5543e08 100644
--- a/src/libstddjb/env_merge.c
+++ b/src/libstddjb/env_merge.c
@@ -16,7 +16,8 @@ size_t env_merge (char const **v, size_t vmax, char const *const *envp, size_t e
{
size_t split = str_chr(modifs + i, '=') ;
size_t j = 0 ;
- for (; j < vlen ; j++) if (!strncmp(modifs + i, v[j], split+1)) break ;
+ for (; j < vlen ; j++)
+ if (!strncmp(modifs + i, v[j], split) && (v[j][split] == '=')) break ;
if (j < vlen) v[j] = v[--vlen] ;
if (modifs[i + split]) v[vlen++] = modifs + i ;
}