From a1dfcce8f1984df37c315f5a63c78d07852c8fd6 Mon Sep 17 00:00:00 2001 From: Avril Date: Wed, 5 Aug 2020 07:27:31 +0100 Subject: [PATCH] generalised fchmod --- Cargo.toml | 2 +- src/ext.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0c32dbb..6b64e14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "readable-perms" description = "More usable UNIX file permissions interface" keywords = ["unix", "fs", "permissions", "file", "chmod"] -version = "0.1.1" +version = "0.1.2" authors = ["Avril "] edition = "2018" license = "GPL-3.0-or-later" diff --git a/src/ext.rs b/src/ext.rs index 3bf4cb1..24aeee7 100644 --- a/src/ext.rs +++ b/src/ext.rs @@ -50,7 +50,8 @@ mod chmod fn chmod(&mut self, mode: impl Into) -> io::Result<()>; } - impl FChmodExt for std::fs::File + impl FChmodExt for T + where T: std::os::unix::io::AsRawFd { /// Perform `chmod` on this file to `mode`. @@ -60,7 +61,7 @@ mod chmod /// If you pass raw `mode_t` that is outside the range (0..=0o777), any extra bits are ignored. fn chmod(&mut self, mode: impl Into) -> io::Result<()> { - use std::os::unix::io::*; + //use std::os::unix::io::*; unsafe { if fchmod(self.as_raw_fd(), mode.into() & 0o777) == 0 { Ok(())