diff options
author | Ray Strode <rstrode@redhat.com> | 2016-08-03 14:35:50 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-02-20 18:49:14 -0500 |
commit | 6162512cde54244127da547917d0e6d5d0a378c3 (patch) | |
tree | 4a819239ab2c2050a8d0dcbe4e668fdad322dc41 /src/basic/env-util.c | |
parent | 1bd2d4e31b739586cf91ddfe65349f79298af013 (diff) |
basic: fix strv_env_get_n for unclean arrays
If an environment array has duplicates, strv_env_get_n returns
the results for the first match. This is wrong, because later
entries in the environment are supposed to replace earlier
entries.
Diffstat (limited to 'src/basic/env-util.c')
-rw-r--r-- | src/basic/env-util.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/basic/env-util.c b/src/basic/env-util.c index a28707fb49..f9208d1475 100644 --- a/src/basic/env-util.c +++ b/src/basic/env-util.c @@ -462,7 +462,7 @@ char *strv_env_get_n(char **l, const char *name, size_t k) { if (k <= 0) return NULL; - STRV_FOREACH(i, l) + STRV_FOREACH_BACKWARDS(i, l) if (strneq(*i, name, k) && (*i)[k] == '=') return *i + k + 1; |