Skip to content

Commit f6906ba

Browse files
committed
use gloabl variable 'environ' to pass environments to rtpSpawn
1 parent 04b88a9 commit f6906ba

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

src/libstd/sys/vxworks/process/process_vxworks.rs

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::io::{self, Error, ErrorKind};
2-
use libc::{self, c_int};
2+
use libc::{self, c_int, c_char};
33
use libc::{RTP_ID};
4-
4+
use crate::sys;
55
use crate::sys::cvt;
66
use crate::sys::process::rtp;
77
use crate::sys::process::process_common::*;
@@ -16,8 +16,6 @@ impl Command {
1616
use crate::sys::{cvt_r};
1717
const CLOEXEC_MSG_FOOTER: &'static [u8] = b"NOEX";
1818

19-
let envp = self.capture_env();
20-
2119
if self.saw_nul() {
2220
return Err(io::Error::new(ErrorKind::InvalidInput,
2321
"nul byte found in provided data"));
@@ -54,19 +52,10 @@ impl Command {
5452
t!(cvt(libc::chdir(cwd.as_ptr())));
5553
}
5654

57-
// let envp = envp.map(|c| c.as_ptr())
58-
// .unwrap_or(*sys::os::environ() as *const _);
59-
// FIXME: https://github.com/rust-lang/rust/issues/61993
60-
let envp_empty = CStringArray::with_capacity(0);
61-
let envp = match envp {
62-
Some(x) => x,
63-
None => envp_empty,
64-
};
65-
let envp = envp.as_ptr();
6655
let ret = rtp::rtpSpawn(
6756
self.get_argv()[0], // executing program
6857
self.get_argv().as_ptr() as *const _, // argv
69-
envp as *const _, // environment variable pointers
58+
*sys::os::environ() as *const *const c_char,
7059
100 as c_int, // initial priority
7160
0x16000, // initial stack size. 0 defaults
7261
// to 0x4000 in 32 bit and 0x8000 in 64 bit

0 commit comments

Comments
 (0)