Module Name: xsrc
Committed By: christos
Date: Sun Apr 24 17:36:11 UTC 2016
Modified Files:
xsrc/external/mit/xman/dist: misc.c
Log Message:
CID 987984: set umask before mkstemp
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 xsrc/external/mit/xman/dist/misc.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/xman/dist/misc.c
diff -u xsrc/external/mit/xman/dist/misc.c:1.7 xsrc/external/mit/xman/dist/misc.c:1.8
--- xsrc/external/mit/xman/dist/misc.c:1.7 Sun Jul 19 19:04:04 2015
+++ xsrc/external/mit/xman/dist/misc.c Sun Apr 24 13:36:11 2016
@@ -374,7 +374,7 @@ UncompressNamed(ManpageGlobals * man_glo
{
char tmp[BUFSIZ], cmdbuf[BUFSIZ], error_buf[BUFSIZ];
struct stat junk;
- int fd;
+ int fd, omask;
if (stat(filename, &junk) != 0) { /* Check for existence of the file. */
if (errno != ENOENT) {
@@ -392,7 +392,9 @@ UncompressNamed(ManpageGlobals * man_glo
*/
strcpy(tmp, MANTEMP); /* get a temp file. */
+ omask = umask(077);
fd = mkstemp(tmp);
+ umask(omask);
if (fd < 0) {
PopupWarning(man_globals, "Error creating a temp file");
return FALSE;
@@ -450,7 +452,7 @@ SgmlToRoffNamed(ManpageGlobals * man_glo
{
char tmp[BUFSIZ], cmdbuf[BUFSIZ], error_buf[BUFSIZ];
struct stat junk;
- int fd;
+ int fd, omask;
if (stat(filename, &junk) != 0) { /* Check for existence of the file. */
if (errno != ENOENT) {
@@ -463,7 +465,9 @@ SgmlToRoffNamed(ManpageGlobals * man_glo
}
strcpy(tmp, MANTEMP); /* get a temp file. */
+ omask = umask(077):
fd = mkstemp(tmp);
+ umask(omask);
if (fd < 0) {
PopupWarning(man_globals, "Error creating a temp file");
return FALSE;
@@ -503,7 +507,7 @@ FILE *
Format(ManpageGlobals * man_globals, const char *entry)
{
FILE *file = NULL;
- int fd;
+ int fd, omask;
Widget manpage = man_globals->manpagewidgets.manpage;
char cmdbuf[BUFSIZ], tmp[BUFSIZ], filename[BUFSIZ], error_buf[BUFSIZ];
@@ -559,7 +563,9 @@ Format(ManpageGlobals * man_globals, con
XFlush(XtDisplay(man_globals->standby));
strcpy(tmp, MANTEMP); /* Get a temp file. */
+ omask = umask(077);
fd = mkstemp(tmp);
+ umask(omask);
if (fd >= 0) {
file = fdopen(fd, "r");
if (file == NULL) {