Skip to content

Prepatory changes for moving to open - #101

Merged
shannonbooth merged 4 commits into
mainfrom
openat-1
Aug 1, 2026
Merged

Prepatory changes for moving to open#101
shannonbooth merged 4 commits into
mainfrom
openat-1

Conversation

@shannonbooth

Copy link
Copy Markdown
Owner

One small grab bag moving towards openat

Tests reach for the filesystem helpers exported by the patching code to
check that a file exists or to make a directory for a fixture. Route
those checks through helpers in the library the tests already link, so
that the tests do not care how the patching code spells its filesystem
access.

This keeps a later change to those helpers out of every test file.
_wmktemp_s reports a failure through its (positive) errno_t return
value, so comparing it against zero from below never caught an error.
The check fetched the permissions of the output file itself, resolving
the whole path by name once more. Instead let the caller say what it
found.
"C:\foo" names the root of drive C, but "C:foo" names foo relative to
whatever the current directory on C happens to be. Classifying the
second as absolute means it is resolved from a root it does not name.

Rejecting absolute names was also the only thing keeping a
drive-relative name out of a patch, so is_safe_patch_path() now refuses
a colon itself. A colon never appears in a Windows file name, since
"file:stream" names an alternate data stream of "file" rather than a
file of that name.
@shannonbooth
shannonbooth merged commit e0ae942 into main Aug 1, 2026
10 checks passed
@shannonbooth
shannonbooth deleted the openat-1 branch August 1, 2026 16:54
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.

1 participant