diff --git a/src/exec.rs b/src/exec.rs index f310d43dc4..c0587cc85d 100644 --- a/src/exec.rs +++ b/src/exec.rs @@ -41,7 +41,6 @@ pub fn main() -> ! { initfs_length = initfs_length_opt.expect("missing INITFS_LENGTH"); let iter = || raw_iter().filter(|var| !var.starts_with(b"INITFS_")); - let env_count = iter().count(); iter().map(|var| var.to_owned()).collect::>() }; @@ -71,9 +70,10 @@ pub fn main() -> ! { } unsafe fn spawn_initfs(initfs_start: usize, initfs_length: usize) { - let mut buf = [0; 2]; - syscall::pipe2(&mut buf, syscall::O_CLOEXEC).expect("failed to open sync pipe"); - let [read, write] = buf; + let read = syscall::open("pipe:", O_CLOEXEC).expect("failed to open sync read pipe"); + + // The write pipe will not inherit O_CLOEXEC, but is closed by the daemon later. + let write = syscall::dup(read, b"write").expect("failed to open sync write pipe"); match redox_exec::fork_impl() { Err(err) => { diff --git a/src/initfs.rs b/src/initfs.rs index 473666dd0e..7303134594 100644 --- a/src/initfs.rs +++ b/src/initfs.rs @@ -258,6 +258,7 @@ pub fn run(bytes: &'static [u8], sync_pipe: usize) -> ! { .expect("failed to open initfs scheme socket"); let _ = syscall::write(sync_pipe, &[0]); + let _ = syscall::close(sync_pipe); let mut packet = Packet::default(); @@ -280,6 +281,6 @@ pub fn run(bytes: &'static [u8], sync_pipe: usize) -> ! { } } } - syscall::exit(0); + syscall::exit(0).expect("initfs: failed to exit"); unreachable!() } diff --git a/src/lib.rs b/src/lib.rs index b0601dd061..3a000f6847 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,6 @@ #![no_std] #![feature( asm_const, - asm_sym, alloc_error_handler, core_intrinsics, lang_items,