From a75f3fa04c12d5190b39fb9c03f67c301f61f8a8 Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Sat, 30 Sep 2017 21:09:06 +0200 Subject: unistd: groups: Respond to minor PR feedback items --- test/test_unistd.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'test') 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(); -- cgit v1.2.3