diff options
author | Jamie Hewland <jhewland@gmail.com> | 2017-09-30 21:09:06 +0200 |
---|---|---|
committer | Jamie Hewland <jhewland@gmail.com> | 2017-11-12 11:03:51 +0200 |
commit | a75f3fa04c12d5190b39fb9c03f67c301f61f8a8 (patch) | |
tree | 63b24e4169be4c4c1764afea60594553311f80e6 /test | |
parent | 57246cfe56559e067fa9ee507746c42e4a92a958 (diff) | |
download | nix-a75f3fa04c12d5190b39fb9c03f67c301f61f8a8.zip |
unistd: groups: Respond to minor PR feedback items
Diffstat (limited to 'test')
-rw-r--r-- | test/test_unistd.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/test/test_unistd.rs b/test/test_unistd.rs index 2bb432d0..672cbb9c 100644 --- a/test/test_unistd.rs +++ b/test/test_unistd.rs @@ -4,7 +4,7 @@ use nix::unistd::*; use nix::unistd::ForkResult::*; use nix::sys::wait::*; use nix::sys::stat; -use std::{env, iter}; +use std::{self, env, iter}; use std::ffi::CString; use std::fs::File; use std::io::Write; @@ -128,11 +128,10 @@ mod linux_android { fn test_setgroups() { // Skip this test when not run as root as `setgroups()` requires root. if !Uid::current().is_root() { - use std::io; - let stderr = io::stderr(); + let stderr = std::io::stderr(); let mut handle = stderr.lock(); writeln!(handle, "test_setgroups requires root privileges. Skipping test.").unwrap(); - return + return; } #[allow(unused_variables)] @@ -159,11 +158,10 @@ fn test_initgroups() { // Skip this test when not run as root as `initgroups()` and `setgroups()` // require root. if !Uid::current().is_root() { - use std::io; - let stderr = io::stderr(); + let stderr = std::io::stderr(); let mut handle = stderr.lock(); writeln!(handle, "test_initgroups requires root privileges. Skipping test.").unwrap(); - return + return; } #[allow(unused_variables)] @@ -175,7 +173,8 @@ fn test_initgroups() { // It doesn't matter if the root user is not called "root" or if a user // called "root" doesn't exist. We are just checking that the extra, // made-up group, `123`, is set. - // FIXME: This only tests half of initgroups' functionality. + // FIXME: Test the other half of initgroups' functionality: whether the + // groups that the user belongs to are also set. let user = CString::new("root").unwrap(); let group = Gid::from_raw(123); let group_list = getgrouplist(&user, group).unwrap(); |