diff options
-rw-r--r-- | jim-exec.c | 4 | ||||
-rw-r--r-- | jim-file.c | 2 |
2 files changed, 5 insertions, 1 deletions
@@ -126,6 +126,7 @@ int Jim_execInit(Jim_Interp *interp) #include <unistd.h> #include <fcntl.h> #include <sys/wait.h> + #include <sys/stat.h> typedef int fdtype; typedef int pidtype; @@ -1576,8 +1577,9 @@ static int JimRewindFd(int fd) static int JimCreateTemp(Jim_Interp *interp, const char *contents, int len) { char inName[] = "/tmp/tcl.tmp.XXXXXX"; - + mode_t mask = umask(S_IXUSR | S_IRWXG | S_IRWXO); int fd = mkstemp(inName); + umask(mask); if (fd == JIM_BAD_FD) { Jim_SetResultErrno(interp, "couldn't create temp file"); return -1; @@ -489,6 +489,7 @@ static int file_cmd_tempfile(Jim_Interp *interp, int argc, Jim_Obj *const *argv) int fd; char *filename; const char *template = "/tmp/tcl.tmp.XXXXXX"; + mode_t mask = umask(S_IXUSR | S_IRWXG | S_IRWXO); if (argc >= 1) { template = Jim_String(argv[0]); @@ -496,6 +497,7 @@ static int file_cmd_tempfile(Jim_Interp *interp, int argc, Jim_Obj *const *argv) filename = Jim_StrDup(template); fd = mkstemp(filename); + umask(mask); if (fd < 0) { Jim_SetResultString(interp, "Failed to create tempfile", -1); Jim_Free(filename); |