diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 |
| commit | 044eb2f6afba375a914ac9d8024f8f5142bb912e (patch) | |
| tree | 1475247dc9f9fe5be155ebd4c9069c75aadf8c20 /lib/Support/Windows/Process.inc | |
| parent | eb70dddbd77e120e5d490bd8fbe7ff3f8fa81c6b (diff) | |
Notes
Diffstat (limited to 'lib/Support/Windows/Process.inc')
| -rw-r--r-- | lib/Support/Windows/Process.inc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Support/Windows/Process.inc b/lib/Support/Windows/Process.inc index 18aef610d54a..3fe9f89f1ef5 100644 --- a/lib/Support/Windows/Process.inc +++ b/lib/Support/Windows/Process.inc @@ -129,9 +129,10 @@ Optional<std::string> Process::GetEnv(StringRef Name) { size_t Size = MAX_PATH; do { Buf.reserve(Size); + SetLastError(NO_ERROR); Size = - GetEnvironmentVariableW(NameUTF16.data(), Buf.data(), Buf.capacity()); - if (Size == 0) + GetEnvironmentVariableW(NameUTF16.data(), Buf.data(), Buf.capacity()); + if (Size == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND) return None; // Try again with larger buffer. |
