diff options
| author | BurntPizza <xburntpizza@gmail.com> | 2018-08-08 18:23:52 -0400 |
|---|---|---|
| committer | BurntPizza <xburntpizza@gmail.com> | 2018-08-09 12:56:42 -0400 |
| commit | c9aca0232064ab3f67eec4ceda3258caa3866129 (patch) | |
| tree | a4404a7f3ab4187c02ddab76226633a49ea472d5 /src/libstd/sys | |
| parent | b73535f1e9c46a698527fab51b1cc9fad3f53412 (diff) | |
| download | rust-c9aca0232064ab3f67eec4ceda3258caa3866129.tar.gz rust-c9aca0232064ab3f67eec4ceda3258caa3866129.zip | |
Don't panic on std::env::vars() when env in null.
Fixes #53200
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/unix/os.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index 08c3e154978..f8f0bbd5bc2 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -414,12 +414,8 @@ pub fn env() -> Env { unsafe { let _guard = ENV_LOCK.lock(); let mut environ = *environ(); - if environ == ptr::null() { - panic!("os::env() failure getting env string from OS: {}", - io::Error::last_os_error()); - } let mut result = Vec::new(); - while *environ != ptr::null() { + while environ != ptr::null() && *environ != ptr::null() { if let Some(key_value) = parse(CStr::from_ptr(*environ).to_bytes()) { result.push(key_value); } |
