https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66936
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #7 from kargl at gcc dot gnu.org --- (In reply to Keith Marshall from comment #6) > (In reply to kargl from comment #4) > > Update title. The code in question is > > > > #ifdef HAVE_UMASK > > /* Temporarily set the umask such that the file has 0600 permissions. */ > > mode_mask = umask (S_IXUSR | S_IRWXG | S_IRWXO); > > #endif > > > > MinGW appears to define HAVE_UMASK, but MinGW seems to lack > > a correctly written umask(3). > > Just for the record: MinGW has had access to Microsoft's umask() > implementation for a very long time; HAVE_UMASK has always been defined, > when compiling the mingw32 builds of GCC. However, this particular block of > code is encapsulated within an outer #ifdef HAVE_MKSTEMP block, and it is > only recently that MinGW has provided an implementation of mkstemp(), > (Microsoft do not offer one), which has caused HAVE_MKSTEMP to become > defined, so exposing this (presumably long-standing) bug. So add #define S_IRWXG 0 #define S_IRWXO 0 to the header file wherever mingw defines the available mask bits for umask(3). The bug is clearly in mingw were it gratuitously maps umask() to _umask() without properly adding the mappings for the mode_t argument bits of umask(3).