Skip to content

Commit

Permalink
remove uclibc/linux target and format test code
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveLauC committed Oct 10, 2022
1 parent 39369cd commit dcd8cce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/unistd.rs
Expand Up @@ -2939,7 +2939,11 @@ pub fn faccessat<P: ?Sized + NixPath>(dirfd: Option<RawFd>, path: &P, mode: Acce
///
/// * [freeBSD man page](https://www.freebsd.org/cgi/man.cgi?query=eaccess&sektion=2&n=1)
/// * [Linux man page](https://man7.org/linux/man-pages/man3/euidaccess.3.html)
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly"))]
#[cfg(any(
all(target_os = "linux", not(target_env = "uclibc")),
target_os = "freebsd",
target_os = "dragonfly"
))]
pub fn eaccess<P: ?Sized + NixPath>(path: &P, mode: AccessFlags) -> Result<()> {
let res = path.with_nix_path(|cstr| {
unsafe {
Expand Down
12 changes: 10 additions & 2 deletions test/test_unistd.rs
Expand Up @@ -1378,7 +1378,11 @@ fn test_faccessat_file_exists() {
}

#[test]
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly"))]
#[cfg(any(
all(target_os = "linux", not(target_env = "uclibc")),
target_os = "freebsd",
target_os = "dragonfly"
))]
fn test_eaccess_not_existing() {
let tempdir = tempdir().unwrap();
let dir = tempdir.path().join("does_not_exist.txt");
Expand All @@ -1389,7 +1393,11 @@ fn test_eaccess_not_existing() {
}

#[test]
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly"))]
#[cfg(any(
all(target_os = "linux", not(target_env = "uclibc")),
target_os = "freebsd",
target_os = "dragonfly"
))]
fn test_eaccess_file_exists() {
let tempdir = tempdir().unwrap();
let path = tempdir.path().join("does_exist.txt");
Expand Down

0 comments on commit dcd8cce

Please sign in to comment.