Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 17d03b9

Browse files
committedJun 24, 2024
Check that we get somewhat sane PIDs when spawning with pidfds
1 parent 4c9a96e commit 17d03b9

File tree

1 file changed

+3
-0
lines changed
  • std/src/sys/pal/unix/linux/pidfd

1 file changed

+3
-0
lines changed
 

‎std/src/sys/pal/unix/linux/pidfd/tests.rs

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ fn test_command_pidfd() {
2121
let flags = super::cvt(unsafe { libc::fcntl(pidfd.as_raw_fd(), libc::F_GETFD) }).unwrap();
2222
assert!(flags & libc::FD_CLOEXEC != 0);
2323
}
24+
assert!(child.id() > 0 && child.id() < -1i32 as u32);
2425
let status = child.wait().expect("error waiting on pidfd");
2526
assert_eq!(status.code(), Some(1));
2627

@@ -47,6 +48,8 @@ fn test_command_pidfd() {
4748
let mut child =
4849
unsafe { Command::new("false").pre_exec(|| Ok(())) }.create_pidfd(true).spawn().unwrap();
4950

51+
assert!(child.id() > 0 && child.id() < -1i32 as u32);
52+
5053
if pidfd_open_available {
5154
assert!(child.pidfd().is_ok())
5255
}

0 commit comments

Comments
 (0)
Failed to load comments.