diff options
author | James McCoy <jamessan@jamessan.com> | 2019-12-04 08:01:05 -0500 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2019-12-11 22:04:29 -0500 |
commit | 39963c6a04afc417a821b2255a5caea4b7955d7d (patch) | |
tree | a22cfc7c68f1650bc9b177d25438df52e3cde5ab /src | |
parent | 6dc10057876d1bf75c5cf1ea45cb4312160f13f0 (diff) | |
download | rneovim-39963c6a04afc417a821b2255a5caea4b7955d7d.tar.gz rneovim-39963c6a04afc417a821b2255a5caea4b7955d7d.tar.bz2 rneovim-39963c6a04afc417a821b2255a5caea4b7955d7d.zip |
os_getenvname_at_index: Handle Windows env vars whose name starts with =
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/os/env.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index ac442ee2e8..360609c50d 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -302,7 +302,10 @@ char *os_getenvname_at_index(size_t index) break; } - const char * const end = strchr(utf8_str, '='); + // Some Windows env vars start with =, so skip over that to find the + // separator between name/value + const char * const end = strchr(utf8_str + (utf8_str[0] == '=' ? 1 : 0), + '='); assert(end != NULL); ptrdiff_t len = end - utf8_str; assert(len > 0); |