From bae5db9fdf7b5dc24d4c2aca2ace672680c32dfd Mon Sep 17 00:00:00 2001 From: Kamal Marhubi Date: Mon, 21 Mar 2016 18:45:24 -0400 Subject: [PATCH] Use getuid(2) from nix instead of libc in test_mount --- test/test_mount.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_mount.rs b/test/test_mount.rs index b5ceb8d2..74d2938c 100644 --- a/test/test_mount.rs +++ b/test/test_mount.rs @@ -20,6 +20,7 @@ mod test_mount { use nix::mount::{mount, umount, MsFlags, MS_BIND, MS_RDONLY, MS_NOEXEC}; use nix::sched::{unshare, CLONE_NEWNS, CLONE_NEWUSER}; use nix::sys::stat::{self, S_IRWXU, S_IRWXG, S_IRWXO, S_IXUSR, S_IXGRP, S_IXOTH}; + use nix::unistd::getuid; use tempdir::TempDir; @@ -171,7 +172,7 @@ exit 23"; pub fn setup_namespaces() { // Hold on to the uid in the parent namespace. - let uid = unsafe { libc::getuid() }; + let uid = getuid(); unshare(CLONE_NEWNS | CLONE_NEWUSER).unwrap_or_else(|e| { let stderr = io::stderr();