fix: restore the mode when an nfsopenhack open fails

- nfsopenhack adds S_IWUSR|S_IWGRP to a read-only file so the open
  can succeed, and resets the mode on the new fd. When the open still
  failed, the write bits stayed on the file.
- Put the original mode back before returning EACCES.
This commit is contained in:
Antonio SJ Musumeci 2026-11-21 14:35:16 -05:00
parent 92c5f57f6d
commit fbca508a31

View file

@ -142,7 +142,10 @@ _lchmod_and_open_if_not_writable_and_empty(const fs::path &fullpath_,
rv = fs::open(fullpath_,flags_);
if(rv < 0)
return -EACCES;
{
fs::lchmod(fullpath_,st.st_mode);
return -EACCES;
}
fs::fchmod(rv,st.st_mode);