Skip to content

Commit

Permalink
Append zero at the end of inherited_fds automatically (nervosnetwork#126
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mohanson authored Nov 14, 2024
1 parent 48db1fe commit 52ca88c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion contracts/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion contracts/exec-callee/exec-callee-dbg/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion contracts/spawn-caller-by-code-hash/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion src/high_level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,8 @@ pub fn spawn_cell(
argv: &[&CStr],
inherited_fds: &[u64],
) -> Result<u64, SysError> {
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)?;
Expand All @@ -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.
Expand Down

0 comments on commit 52ca88c

Please sign in to comment.