]> git.proxmox.com Git - rustc.git/blob - tests/ui/command/command-setgroups.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / command / command-setgroups.rs
1 // run-pass
2 // ignore-windows - this is a unix-specific test
3 // ignore-emscripten
4 // ignore-sgx
5 // ignore-musl - returns dummy result for _SC_NGROUPS_MAX
6
7 #![feature(rustc_private)]
8 #![feature(setgroups)]
9
10 extern crate libc;
11 use std::process::Command;
12 use std::os::unix::process::CommandExt;
13
14 fn main() {
15 #[cfg(unix)]
16 run()
17 }
18
19 #[cfg(unix)]
20 fn run() {
21 let max_ngroups = unsafe { libc::sysconf(libc::_SC_NGROUPS_MAX) };
22 let max_ngroups = max_ngroups as u32 + 1;
23 let vec: Vec<u32> = (0..max_ngroups).collect();
24 let p = Command::new("/bin/id").groups(&vec[..]).spawn();
25 assert!(p.is_err());
26 }