We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
nix::sys::stat::lstat
libc::lstat
1 parent 70781ac commit 6ca40bcCopy full SHA for 6ca40bc
1 file changed
cli/src/utils/os/unix/fs.rs
@@ -22,12 +22,7 @@ pub(crate) fn chmod(path: &Path, mode: u16) -> io::Result<()> {
22
23
#[cfg(target_os = "macos")]
24
pub(crate) fn get_flags(path: &Path) -> io::Result<Vec<String>> {
25
- use std::os::unix::ffi::OsStrExt;
26
- let c_path = std::ffi::CString::new(path.as_os_str().as_bytes())?;
27
- let mut stat: libc::stat = unsafe { std::mem::zeroed() };
28
- if unsafe { libc::lstat(c_path.as_ptr(), &mut stat) } != 0 {
29
- return Err(io::Error::last_os_error());
30
- }
+ let stat = nix::sys::stat::lstat(path)?;
31
let flags = stat.st_flags;
32
let mut flag_names = Vec::new();
33
if flags & libc::UF_NODUMP != 0 {
0 commit comments