This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix simple/test-fs-utimes.js on windows
- Loading branch information
Showing
1 changed file
with
8 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99757cb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@igorzi: Why do you need to open the file with
r+
on Windows?99757cb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bnoordhuis sorry for the delay.. on Windows futimes is implemented using SetFileTime, which requires the file handle to be opened with
FILE_WRITE_ATTRIBUTES
access right.r
maps toO_RDONLY
, which doesn't getFILE_WRITE_ATTRIBUTES
right.r+
maps toO_RDWR
, which does getFILE_WRITE_ATTRIBUTES
right. Are there any Unices that requirer+
for futimes?99757cb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, @piscisaureus told me more or less the same.
No. Opening the file in read-only mode is enough to update file attributes. Regular uid/gid access control still applies, of course.
99757cb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@igorzi Could you add a comment in the code explaining that, for when we forget all about this? Thanks.