Skip to content

Commit

Permalink
Comment out the parts with #[cfg(feature = "selinux")] in get_attr an…
Browse files Browse the repository at this point in the history
  • Loading branch information
lurenJBD authored Nov 20, 2024
1 parent 1eecd4b commit eb7aace
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions native/src/base/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,16 +636,16 @@ impl FsPath {
libc::lstat(self.as_ptr(), &mut attr.st).as_os_err()?;

#[cfg(feature = "selinux")]
{
let sz = libc::lgetxattr(
self.as_ptr(),
XATTR_NAME_SELINUX.as_ptr().cast(),
attr.con.as_mut_ptr().cast(),
attr.con.capacity(),
)
.check_os_err()?;
attr.con.set_len((sz - 1) as usize);
}
// {
// let sz = libc::lgetxattr(
// self.as_ptr(),
// XATTR_NAME_SELINUX.as_ptr().cast(),
// attr.con.as_mut_ptr().cast(),
// attr.con.capacity(),
// )
// .check_os_err()?;
// attr.con.set_len((sz - 1) as usize);
// }
}
Ok(attr)
}
Expand All @@ -658,16 +658,16 @@ impl FsPath {
libc::lchown(self.as_ptr(), attr.st.st_uid, attr.st.st_gid).as_os_err()?;

#[cfg(feature = "selinux")]
if !attr.con.is_empty() {
libc::lsetxattr(
self.as_ptr(),
XATTR_NAME_SELINUX.as_ptr().cast(),
attr.con.as_ptr().cast(),
attr.con.len() + 1,
0,
)
.as_os_err()?;
}
// if !attr.con.is_empty() {
// libc::lsetxattr(
// self.as_ptr(),
// XATTR_NAME_SELINUX.as_ptr().cast(),
// attr.con.as_ptr().cast(),
// attr.con.len() + 1,
// 0,
// )
// .as_os_err()?;
// }
}
Ok(())
}
Expand Down

0 comments on commit eb7aace

Please sign in to comment.