summaryrefslogtreecommitdiff
path: root/src/fcntl.rs
diff options
context:
space:
mode:
authorXavier L'Heureux <xavier.lheureux@icloud.com>2019-09-12 12:46:13 -0400
committerXavier L'Heureux <dev.xlheureux@gmail.com>2020-05-17 21:05:46 -0400
commit57fa56fb30dea6c7f9e54d31e4931a687e533787 (patch)
treeaf14b86363b6af210f88d5666d7bc9e216be6cdb /src/fcntl.rs
parent4c28b9f164481fc39afc3e46c54cadfb1979a6ff (diff)
downloadnix-57fa56fb30dea6c7f9e54d31e4931a687e533787.zip
Make sure to leave the values as-is in open
Diffstat (limited to 'src/fcntl.rs')
-rw-r--r--src/fcntl.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/fcntl.rs b/src/fcntl.rs
index 6b554c23..06b79e44 100644
--- a/src/fcntl.rs
+++ b/src/fcntl.rs
@@ -163,8 +163,7 @@ libc_bitflags!(
pub fn open<P: ?Sized + NixPath>(path: &P, oflag: OFlag, mode: Mode) -> Result<RawFd> {
let fd = path.with_nix_path(|cstr| {
- let modebits = c_uint::from(mode.bits());
- unsafe { libc::open(cstr.as_ptr(), oflag.bits(), modebits) }
+ unsafe { libc::open(cstr.as_ptr(), oflag.bits(), mode.bits() as c_uint) }
})?;
Errno::result(fd)
@@ -178,8 +177,7 @@ pub fn openat<P: ?Sized + NixPath>(
mode: Mode,
) -> Result<RawFd> {
let fd = path.with_nix_path(|cstr| {
- let modebits = c_uint::from(mode.bits());
- unsafe { libc::openat(dirfd, cstr.as_ptr(), oflag.bits(), modebits) }
+ unsafe { libc::openat(dirfd, cstr.as_ptr(), oflag.bits(), mode.bits() as c_uint) }
})?;
Errno::result(fd)
}