Skip to content

Commit 56abfc2

Browse files
committed
Auto merge of rust-lang#328 - kamalmarhubi:test_mount-getuid, r=posborne
Use getuid(2) from nix instead of libc in test_mount
2 parents 8e65328 + bae5db9 commit 56abfc2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/test_mount.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ mod test_mount {
2020
use nix::mount::{mount, umount, MsFlags, MS_BIND, MS_RDONLY, MS_NOEXEC};
2121
use nix::sched::{unshare, CLONE_NEWNS, CLONE_NEWUSER};
2222
use nix::sys::stat::{self, S_IRWXU, S_IRWXG, S_IRWXO, S_IXUSR, S_IXGRP, S_IXOTH};
23+
use nix::unistd::getuid;
2324

2425
use tempdir::TempDir;
2526

@@ -171,7 +172,7 @@ exit 23";
171172

172173
pub fn setup_namespaces() {
173174
// Hold on to the uid in the parent namespace.
174-
let uid = unsafe { libc::getuid() };
175+
let uid = getuid();
175176

176177
unshare(CLONE_NEWNS | CLONE_NEWUSER).unwrap_or_else(|e| {
177178
let stderr = io::stderr();

0 commit comments

Comments
 (0)