Rename OFlag/AtFlag to OFlags/AtFlags. (#1951)
* Rename `OFlag`/`AtFlag` to `OFlags`/`AtFlags`. This makes them consistent with `PollFlags` and common usage of bitflags types in Rust code in general. POSIX does tend to use names like `oflag` and `flag`, so this is in mild disagreement with POSIX style, however I find this particular aspects of POSIX confusing because these values hold multiple flags. * rustfmt
This commit is contained in:
@@ -23,16 +23,16 @@ impl TryFrom<File> for OsDir {
|
||||
}
|
||||
|
||||
fn get_rights(file: &File) -> io::Result<HandleRights> {
|
||||
use yanix::{fcntl, file::OFlag};
|
||||
use yanix::{fcntl, file::OFlags};
|
||||
let mut rights = HandleRights::new(
|
||||
types::Rights::directory_base(),
|
||||
types::Rights::directory_inheriting(),
|
||||
);
|
||||
let flags = unsafe { fcntl::get_status_flags(file.as_raw_fd())? };
|
||||
let accmode = flags & OFlag::ACCMODE;
|
||||
if accmode == OFlag::RDONLY {
|
||||
let accmode = flags & OFlags::ACCMODE;
|
||||
if accmode == OFlags::RDONLY {
|
||||
rights.base &= !types::Rights::FD_WRITE;
|
||||
} else if accmode == OFlag::WRONLY {
|
||||
} else if accmode == OFlags::WRONLY {
|
||||
rights.base &= !types::Rights::FD_READ;
|
||||
}
|
||||
Ok(rights)
|
||||
|
||||
Reference in New Issue
Block a user