about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSébastien Marie <semarie@users.noreply.github.com>2015-11-27 13:48:07 +0100
committerSébastien Marie <semarie@users.noreply.github.com>2015-11-27 13:48:07 +0100
commitefc17a598cf0d9974954369e87feb63ecdd79c96 (patch)
tree2fca6ae73f6503f1eb3d29e8c9d1653637b72c93 /src
parente5aa92a0df5cd90ed2dc364e0d335c87b23355bf (diff)
downloadrust-efc17a598cf0d9974954369e87feb63ecdd79c96.tar.gz
rust-efc17a598cf0d9974954369e87feb63ecdd79c96.zip
pass at least one argument to execve
under OpenBSD and Bitrig, it is an error to pass an empty argv
argument to execve(2). It results the test fail as execve(2) don't exec
and set errno to EINVAL.

instead, make argv with two arguments (in order to differenciate the
initial call, from the execve call).
Diffstat (limited to 'src')
-rw-r--r--src/test/run-pass/env-funky-keys.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/run-pass/env-funky-keys.rs b/src/test/run-pass/env-funky-keys.rs
index 3ee20980747..4d68a4445bb 100644
--- a/src/test/run-pass/env-funky-keys.rs
+++ b/src/test/run-pass/env-funky-keys.rs
@@ -26,7 +26,7 @@ use std::ffi::OsStr;
 use std::ptr;
 
 fn main() {
-    if env::args_os().next().is_none() {
+    if env::args_os().count() == 2 {
         for (key, value) in env::vars_os() {
             panic!("found env value {:?} {:?}", key, value);
         }
@@ -36,7 +36,7 @@ fn main() {
     let current_exe = env::current_exe().unwrap().into_os_string().to_cstring().unwrap();
     let new_env_var = OsStr::new("FOOBAR").to_cstring().unwrap();
     let filename: *const c_char = current_exe.as_ptr();
-    let argv: &[*const c_char] = &[ptr::null()];
+    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]);