diff --git a/src/exec.rs b/src/exec.rs index f310d43dc4..524a12308f 100644 --- a/src/exec.rs +++ b/src/exec.rs @@ -71,9 +71,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:", syscall::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..5c6fd84f4c 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();