Skip to content

export: fix Lutimes on windows#38

Open
omar-polo wants to merge 2 commits into
mainfrom
op/fs-fix-lutimes-on-windows
Open

export: fix Lutimes on windows#38
omar-polo wants to merge 2 commits into
mainfrom
op/fs-fix-lutimes-on-windows

Conversation

@omar-polo

Copy link
Copy Markdown
Collaborator

On windows it's not possible to get a handle on a directory like it's possible to get a file descriptor on unix: FILE_FLAG_BACKUP_SEMANTICS is required for getting handles on directories.

Unfortunately, windows.Open, which is a wrapper around windows.CreateFile, passes other flags that override FILE_FLAG_BACKUP_SEMANTICS, so use CreateFile directly.

FILE_FLAG_BACKUP_SEMANTICS is also safe to use on files.

c.f. https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew

On windows it's not possible to get a handle on a directory like it's
possible to get a file descriptor on unix: FILE_FLAG_BACKUP_SEMANTICS
is required for getting handles on directories.

Unfortunately, windows.Open, which is a wrapper around
windows.CreateFile, passes other flags that override
FILE_FLAG_BACKUP_SEMANTICS, so use CreateFile directly.

FILE_FLAG_BACKUP_SEMANTICS is also safe to use on files.

c.f. https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew
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.

2 participants