[Bug 38348] New: _wsopen_s does not respect the pmode parameter when O_CREAT is set

wine-bugs at winehq.org wine-bugs at winehq.org
Fri Apr 3 14:30:55 CDT 2015


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 at winehq.org
          Reporter: phkelley at 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.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list