Skip to content

stbridge/saf: Fix missing O_RDWR in Create() and enforce PFD modes - #215

Merged
chenxiaolong merged 1 commit into
masterfrom
create
Jul 29, 2026
Merged

stbridge/saf: Fix missing O_RDWR in Create() and enforce PFD modes#215
chenxiaolong merged 1 commit into
masterfrom
create

Conversation

@chenxiaolong

Copy link
Copy Markdown
Owner

safFilesystem.Create() was not passing in O_RDWR, which caused it to either fail (Android 17+ with FileSystemProvider) or return a read-only safFile instance (all other scenarios). This didn't actually break anything since Create() is only used in the happy optimization path when renaming files with file versioning enabled. If it fails, Syncthing falls back to copy-and-delete.

This commit also updates safNode.OpenFile() to enforce Android 17's ParcelFileDescriptor mode string restrictions so that the behavior is consistent across all Android versions.

Fixes: #214

safFilesystem.Create() was not passing in O_RDWR, which caused it to
either fail (Android 17+ with FileSystemProvider) or return a read-only
safFile instance (all other scenarios). This didn't actually break
anything since Create() is only used in the happy optimization path when
renaming files with file versioning enabled. If it fails, Syncthing
falls back to copy-and-delete.

This commit also updates safNode.OpenFile() to enforce Android 17's
ParcelFileDescriptor mode string restrictions so that the behavior is
consistent across all Android versions.

Fixes: #214

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
chenxiaolong added a commit that referenced this pull request Jul 29, 2026
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
@chenxiaolong
chenxiaolong merged commit 5db9ed3 into master Jul 29, 2026
1 check passed
@chenxiaolong
chenxiaolong deleted the create branch July 29, 2026 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SAF Create() omits O_RDWR and returns a non-writable file

1 participant