Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix one more place that was depending on std::os::unix::fs::PermissionsExt #345

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions cap-primitives/src/fs/permissions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ impl Permissions {
#[allow(clippy::unnecessary_wraps)]
fn _into_std(self, _file: &fs::File) -> io::Result<fs::Permissions> {
use std::os::unix::fs::PermissionsExt;
Ok(fs::Permissions::from_mode(self.ext.mode()))
Ok(fs::Permissions::from_mode(crate::fs::PermissionsExt::mode(
&self.ext,
)))
}

#[cfg(target_os = "wasi")]
Expand Down Expand Up @@ -109,19 +111,19 @@ pub trait PermissionsExt {
impl PermissionsExt for Permissions {
#[inline]
fn mode(&self) -> u32 {
std::os::unix::fs::PermissionsExt::mode(&self.ext)
crate::fs::PermissionsExt::mode(&self.ext)
}

#[inline]
fn set_mode(&mut self, mode: u32) {
std::os::unix::fs::PermissionsExt::set_mode(&mut self.ext, mode)
crate::fs::PermissionsExt::set_mode(&mut self.ext, mode)
}

#[inline]
fn from_mode(mode: u32) -> Self {
Self {
readonly: ImplPermissionsExt::readonly(mode as RawMode),
ext: std::os::unix::fs::PermissionsExt::from_mode(mode),
ext: crate::fs::PermissionsExt::from_mode(mode),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion cap-primitives/src/rustix/fs/permissions_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl ImplPermissionsExt {
}

#[cfg(not(target_os = "wasi"))]
impl std::os::unix::fs::PermissionsExt for ImplPermissionsExt {
impl crate::fs::PermissionsExt for ImplPermissionsExt {
fn mode(&self) -> u32 {
self.mode as u32
}
Expand Down