Module Name: xsrc
Committed By: christos
Date: Thu Sep 18 19:23:10 UTC 2014
Modified Files:
xsrc/external/mit/libXfont/dist/src/fontfile: fileio.c filewr.c
Log Message:
Set close-on-exec for font file i/o.
To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.2 \
xsrc/external/mit/libXfont/dist/src/fontfile/fileio.c \
xsrc/external/mit/libXfont/dist/src/fontfile/filewr.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/libXfont/dist/src/fontfile/fileio.c
diff -u xsrc/external/mit/libXfont/dist/src/fontfile/fileio.c:1.1.1.3 xsrc/external/mit/libXfont/dist/src/fontfile/fileio.c:1.2
--- xsrc/external/mit/libXfont/dist/src/fontfile/fileio.c:1.1.1.3 Thu May 30 21:08:57 2013
+++ xsrc/external/mit/libXfont/dist/src/fontfile/fileio.c Thu Sep 18 15:23:10 2014
@@ -36,6 +36,9 @@ in this Software without prior written a
#ifndef O_BINARY
#define O_BINARY O_RDONLY
#endif
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
FontFilePtr
FontFileOpen (const char *name)
@@ -44,7 +47,7 @@ FontFileOpen (const char *name)
int len;
BufFilePtr raw, cooked;
- fd = open (name, O_BINARY);
+ fd = open (name, O_BINARY|O_CLOEXEC);
if (fd < 0)
return 0;
raw = BufFileOpenRead (fd);
Index: xsrc/external/mit/libXfont/dist/src/fontfile/filewr.c
diff -u xsrc/external/mit/libXfont/dist/src/fontfile/filewr.c:1.1.1.3 xsrc/external/mit/libXfont/dist/src/fontfile/filewr.c:1.2
--- xsrc/external/mit/libXfont/dist/src/fontfile/filewr.c:1.1.1.3 Thu May 30 21:08:57 2013
+++ xsrc/external/mit/libXfont/dist/src/fontfile/filewr.c Thu Sep 18 15:23:10 2014
@@ -33,17 +33,19 @@ in this Software without prior written a
#endif
#include <X11/fonts/fntfilio.h>
#include <X11/Xos.h>
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
FontFilePtr
FontFileOpenWrite (const char *name)
{
int fd;
-#if defined(WIN32) || defined(__CYGWIN__)
- fd = open (name, O_CREAT|O_TRUNC|O_RDWR|O_BINARY, 0666);
-#else
- fd = creat (name, 0666);
-#endif
+ fd = open (name, O_CREAT|O_TRUNC|O_RDWR|O_BINARY|O_CLOEXEC, 0666);
if (fd < 0)
return 0;
return (FontFilePtr) BufFileOpenWrite (fd);