diff options
Diffstat (limited to 'src/test/ui/env-funky-keys.rs')
-rw-r--r-- | src/test/ui/env-funky-keys.rs | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/test/ui/env-funky-keys.rs b/src/test/ui/env-funky-keys.rs deleted file mode 100644 index 46e20d8c6..000000000 --- a/src/test/ui/env-funky-keys.rs +++ /dev/null @@ -1,43 +0,0 @@ -// run-pass -// Ignore this test on Android, because it segfaults there. - -// ignore-android -// ignore-windows -// ignore-emscripten no execve -// ignore-sgx no execve -// ignore-vxworks no execve -// ignore-fuchsia no 'execve' -// no-prefer-dynamic - -#![feature(rustc_private)] - -extern crate libc; - -use libc::c_char; -use libc::execve; -use std::env; -use std::ffi::CString; -use std::os::unix::prelude::*; -use std::ptr; - -fn main() { - if env::args_os().count() == 2 { - for (key, value) in env::vars_os() { - panic!("found env value {:?} {:?}", key, value); - } - return; - } - - let current_exe = CString::new(env::current_exe() - .unwrap() - .as_os_str() - .as_bytes()).unwrap(); - let new_env_var = CString::new("FOOBAR").unwrap(); - let filename: *const c_char = current_exe.as_ptr(); - let argv: &[*const c_char] = &[filename, filename, ptr::null()]; - let envp: &[*const c_char] = &[new_env_var.as_ptr(), ptr::null()]; - unsafe { - execve(filename, &argv[0], &envp[0]); - } - panic!("execve failed"); -} |