From c9aca0232064ab3f67eec4ceda3258caa3866129 Mon Sep 17 00:00:00 2001 From: BurntPizza Date: Wed, 8 Aug 2018 18:23:52 -0400 Subject: Don't panic on std::env::vars() when env in null. Fixes #53200 --- src/libstd/sys/unix/os.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/libstd/sys') 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); } -- cgit 1.4.1-3-g733a5