summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2017-03-08 00:12:45 +0100
committerJörg Thalheim <joerg@thalheim.io>2017-03-21 01:27:21 +0100
commitb6a8a3c64f63a4f540000084a6ec19d635f48e6c (patch)
tree89c6e13d7113e1a0640c99890ffbc0d6ee53b1f7 /test
parent2b0c63f56dcf69fba328e8d5b2139bc6e5cef930 (diff)
downloadnix-b6a8a3c64f63a4f540000084a6ec19d635f48e6c.zip
add support for `fstatat`
Diffstat (limited to 'test')
-rw-r--r--test/test_stat.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/test/test_stat.rs b/test/test_stat.rs
index 4b22c296..765d4fa1 100644
--- a/test/test_stat.rs
+++ b/test/test_stat.rs
@@ -4,8 +4,8 @@ use std::os::unix::prelude::AsRawFd;
use libc::{S_IFMT, S_IFLNK};
-use nix::sys::stat::{stat, fstat, lstat};
-
+use nix::fcntl;
+use nix::sys::stat::{self, stat, fstat, lstat};
use nix::sys::stat::FileStat;
use nix::Result;
use tempdir::TempDir;
@@ -75,6 +75,21 @@ fn test_stat_and_fstat() {
}
#[test]
+fn test_fstatat() {
+ let tempdir = TempDir::new("nix-test_stat_and_fstat").unwrap();
+ let filename = tempdir.path().join("foo.txt");
+ File::create(&filename).unwrap();
+ let dirfd = fcntl::open(tempdir.path(),
+ fcntl::OFlag::empty(),
+ stat::Mode::empty());
+
+ let result = stat::fstatat(dirfd.unwrap(),
+ &filename,
+ fcntl::AtFlags::empty());
+ assert_stat_results(result);
+}
+
+#[test]
fn test_stat_fstat_lstat() {
let tempdir = TempDir::new("nix-test_stat_fstat_lstat").unwrap();
let filename = tempdir.path().join("bar.txt");