https://bugs.winehq.org/show_bug.cgi?id=38348
Bug ID: 38348 Summary: _wsopen_s does not respect the pmode parameter when O_CREAT is set Product: Wine Version: 1.7.40 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: msvcrt Assignee: wine-bugs@winehq.org Reporter: phkelley@hotmail.com Distribution: ---
When _wsopen_s is invoked to create a new file, the O_CREAT bit will be set in the oflags parameter. The pmode parameter contains the mode for the file to be created.
In Win32, only the S_IREAD and S_IWRITE bits in the mode matter, and Wine is nice enough to alert with a FIXME when any bits other than these two are set.
But even when the bits meet the appropriateness criteria (no bits other than S_IREAD and S_IWRITE), Wine still WARNs that the pmode will be ignored (when O_CREAT is set). And indeed, nothing is done with the pmode parameter by the rest of the routine.
It is very simple to implement the necessary support for pmode at O_CREAT time: 1. Apply the umask, which is stored in MSVCRT_umask, to the pmode to compute the effective mode for this call to _wsopen_s. 2. Check to see if the S_IWRITE bit is missing from the effective mode.
If S_IWRITE is missing, then the "attrib" value (eventually passed on to CreateFile) should start out as FILE_ATTRIBUTE_READONLY rather than FILE_ATTRIBUTE_NORMAL. This will cause the created file to start off with the +R bit set, as requested by the caller.
https://bugs.winehq.org/show_bug.cgi?id=38348
Piotr Caban piotr.caban@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |760b78813d0e75d5d32f60318fe | |2bb4c7a5064b1 Status|UNCONFIRMED |RESOLVED CC| |piotr.caban@gmail.com Resolution|--- |FIXED
--- Comment #1 from Piotr Caban piotr.caban@gmail.com --- It's implemented now. Marking as fixed.
https://bugs.winehq.org/show_bug.cgi?id=38348
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #2 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 1.7.41.