Fix pfs_creat: missing canmodify assignment causes EACCES on write

pfs_creat called pfs_create_file() but never set of->canmodify, leaving
it zero-initialized. pfs_write and pfs_ftruncate both check canmodify
and return -EACCES if false, making all writes to newly created files
fail with Permission denied.

All five open paths in pfs_open set canmodify correctly (added in #326),
but pfs_creat was missed. Fix by applying the same pattern immediately
after psql_unlock(), while fpath is still in scope.

Caught during FUSE 2/3 regression testing (Phase 2 write test).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-03-09 21:16:46 +01:00
parent 7c91dea0ea
commit d8a7aba745
1 changed files with 1 additions and 0 deletions

View File

@ -1715,6 +1715,7 @@ static int pfs_creat(const char *path, mode_t mode,
encoder);
pfs_task_release_folder_tasks_locked(folder);
psql_unlock();
of->canmodify = (fpath->permissions & PSYNC_PERM_MODIFY) != 0;
of->newfile = 1;
of->modified = 1;
ret = open_write_files(of, 1);