Module Name: xsrc
Committed By: christos
Date: Sun Apr 24 18:27:03 UTC 2016
Modified Files:
xsrc/external/mit/ctwm/dist: session.c
Log Message:
CID 1358680: Set umask before mkstemp
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/ctwm/dist/session.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: xsrc/external/mit/ctwm/dist/session.c
diff -u xsrc/external/mit/ctwm/dist/session.c:1.2 xsrc/external/mit/ctwm/dist/session.c:1.3
--- xsrc/external/mit/ctwm/dist/session.c:1.2 Wed Apr 13 18:25:57 2016
+++ xsrc/external/mit/ctwm/dist/session.c Sun Apr 24 14:27:03 2016
@@ -859,7 +859,12 @@ static FILE *unique_file (char **filenam
fd = open(template, O_RDWR | O_CREAT | O_EXCL, 0600);
} while ((fd == -1) && (errno == EEXIST || errno == EINTR));
#else
- if ((fd = mkstemp(tmp)) == -1)
+ {
+ int omask = umask(077);
+ fd = mkstemp(tmp);
+ umask(omask);
+ }
+ if (fd == -1)
return NULL;
#endif
if ((fp = fdopen(fd, "wb")) == NULL)