aboutsummaryrefslogtreecommitdiff
path: root/jimiocompat.c
diff options
context:
space:
mode:
Diffstat (limited to 'jimiocompat.c')
-rw-r--r--jimiocompat.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/jimiocompat.c b/jimiocompat.c
index 8e7f3f2..44a1387 100644
--- a/jimiocompat.c
+++ b/jimiocompat.c
@@ -6,7 +6,7 @@ void Jim_SetResultErrno(Jim_Interp *interp, const char *msg)
Jim_SetResultFormatted(interp, "%s: %s", msg, strerror(Jim_Errno()));
}
-#if defined(__MINGW32__)
+#if defined(_WIN32) || defined(WIN32)
#include <sys/stat.h>
int Jim_Errno(void)
@@ -213,7 +213,9 @@ int Jim_MakeTempFile(Jim_Interp *interp, const char *filename_template, int unli
}
/* Update the template name directly with the filename */
+#ifdef HAVE_UMASK
mask = umask(S_IXUSR | S_IRWXG | S_IRWXO);
+#endif
#ifdef HAVE_MKSTEMP
fd = mkstemp(filenameObj->bytes);
#else
@@ -224,7 +226,9 @@ int Jim_MakeTempFile(Jim_Interp *interp, const char *filename_template, int unli
fd = open(filenameObj->bytes, O_RDWR | O_CREAT | O_TRUNC);
}
#endif
+#ifdef HAVE_UMASK
umask(mask);
+#endif
if (fd < 0) {
Jim_SetResultErrno(interp, Jim_String(filenameObj));
Jim_FreeNewObj(interp, filenameObj);