diff --git a/contracts/Cargo.lock b/contracts/Cargo.lock index 2ca3928..62c243a 100644 --- a/contracts/Cargo.lock +++ b/contracts/Cargo.lock @@ -228,7 +228,7 @@ dependencies = [ [[package]] name = "ckb-std" -version = "0.16.1" +version = "0.16.3" dependencies = [ "buddy-alloc", "cc", diff --git a/contracts/exec-callee/exec-callee-dbg/Cargo.lock b/contracts/exec-callee/exec-callee-dbg/Cargo.lock index 31765f8..4f9a5b0 100644 --- a/contracts/exec-callee/exec-callee-dbg/Cargo.lock +++ b/contracts/exec-callee/exec-callee-dbg/Cargo.lock @@ -219,7 +219,7 @@ dependencies = [ [[package]] name = "ckb-std" -version = "0.16.1" +version = "0.16.3" dependencies = [ "buddy-alloc", "cc", diff --git a/contracts/spawn-caller-by-code-hash/src/entry.rs b/contracts/spawn-caller-by-code-hash/src/entry.rs index b88114f..bc89398 100644 --- a/contracts/spawn-caller-by-code-hash/src/entry.rs +++ b/contracts/spawn-caller-by-code-hash/src/entry.rs @@ -12,7 +12,7 @@ pub fn main() -> Result<(), Error> { CStr::from_bytes_with_nul(b"world\0").unwrap(), ]; let mut std_fds: [u64; 2] = [0, 0]; - let mut son_fds: [u64; 3] = [0, 0, 0]; + let mut son_fds: [u64; 2] = [0, 0]; let (r0, w0) = syscalls::pipe()?; std_fds[0] = r0; son_fds[1] = w0; diff --git a/src/high_level.rs b/src/high_level.rs index de4f641..d716c86 100644 --- a/src/high_level.rs +++ b/src/high_level.rs @@ -700,6 +700,8 @@ pub fn spawn_cell( argv: &[&CStr], inherited_fds: &[u64], ) -> Result { + let mut inherited_fds = Vec::from(inherited_fds); + inherited_fds.push(0); #[cfg(not(feature = "native-simulator"))] { let index = look_for_dep_with_hash2(code_hash, hash_type)?; @@ -716,7 +718,7 @@ pub fn spawn_cell( Ok(process_id) } #[cfg(feature = "native-simulator")] - syscalls::spawn_cell(code_hash, hash_type, argv, inherited_fds) + syscalls::spawn_cell(code_hash, hash_type, argv, &inherited_fds) } /// Get inherited file descriptors. diff --git a/src/syscalls/simulator.rs b/src/syscalls/simulator.rs index a0397fb..a748981 100644 --- a/src/syscalls/simulator.rs +++ b/src/syscalls/simulator.rs @@ -266,6 +266,8 @@ pub fn spawn_cell( argv: &[&CStr], inherited_fds: &[u64], ) -> Result { + let mut inherited_fds = Vec::from(inherited_fds); + inherited_fds.push(0); let argc = argv.len(); let mut argv_vec: alloc::vec::Vec<*const u8> = argv.iter().map(|e| e.as_ptr() as *const u8).collect();