Index: Source/NSData.m =================================================================== --- Source/NSData.m (revisiĆ³n: 38334) +++ Source/NSData.m (copia de trabajo) @@ -1357,6 +1357,16 @@ int desc; int mask; +#if defined(__MINGW__) + strncpy(wthePath, wtheRealPath, sizeof(wthePath) - 1); + wthePath[sizeof(wthePath) - 1] = '\0'; + strncat(wthePath, "XXXXXX", 6); + if ((desc = mkstemp(wthePath)) < 0) + { + NSWarnMLog(@"mkstemp (%s) failed - %@", wthePath, [NSError _last]); + goto failure; + } +#else strncpy(thePath, theRealPath, sizeof(thePath) - 1); thePath[sizeof(thePath) - 1] = '\0'; strncat(thePath, "XXXXXX", 6); @@ -1365,9 +1375,14 @@ NSWarnMLog(@"mkstemp (%s) failed - %@", thePath, [NSError _last]); goto failure; } +#endif mask = umask(0); umask(mask); +#if defined(__MINGW__) + chmod(wthePath, 0644 & ~mask); +#else fchmod(desc, 0644 & ~mask); +#endif if ((theFile = fdopen(desc, "w")) == 0) { close(desc); @@ -1375,9 +1390,15 @@ } else { +#if defined(__MINGW__) + strncpy(wthePath, wtheRealPath, sizeof(wthePath) - 1); + wthePath[sizeof(wthePath) - 1] = '\0'; + theFile = fopen(wthePath, "wb"); +#else strncpy(thePath, theRealPath, sizeof(thePath) - 1); thePath[sizeof(thePath) - 1] = '\0'; theFile = fopen(thePath, "wb"); +#endif } #else if (useAuxiliaryFile)