in src/nodes/mod.rs [128:162]
fn setattr_times(attr: &mut fuse::FileAttr, path: Option<&PathBuf>,
atime: Option<sys::time::TimeVal>, mtime: Option<sys::time::TimeVal>)
-> Result<(), nix::Error> {
if atime.is_none() && mtime.is_none() {
return Ok(());
}
let atime = atime.unwrap_or_else(|| conv::timespec_to_timeval(attr.atime));
let mtime = mtime.unwrap_or_else(|| conv::timespec_to_timeval(attr.mtime));
#[allow(clippy::collapsible_if)]
let result = if cfg!(have_utimensat = "1") {
try_path(path, |p| sys::stat::utimensat(
None, p,
&conv::timeval_to_nix_timespec(atime), &conv::timeval_to_nix_timespec(mtime),
sys::stat::UtimensatFlags::NoFollowSymlink))
} else {
if attr.kind == fuse::FileType::Symlink {
eprintln!(
"utimensat not present; ignoring request to change symlink times for {:?}", path);
Err(nix::Error::from_errno(Errno::EOPNOTSUPP))
} else {
try_path(path, |p| sys::stat::utimes(p, &atime, &mtime))
}
};
if result.is_ok() {
attr.atime = conv::timeval_to_timespec(atime);
attr.mtime = conv::timeval_to_timespec(mtime);
if attr.mtime < attr.crtime {
// BSD semantics say, per the sources of libarchive, that the crtime should be rolled
// back to an earlier mtime.
attr.crtime = attr.mtime;
}
}
result
}