summaryrefslogtreecommitdiff
path: root/src/fontfile/filewr.c
diff options
context:
space:
mode:
authorChristos Zoulas <christos@NetBSD.org>2015-02-25 21:39:30 +0100
committerThomas Klausner <wiz@NetBSD.org>2015-02-26 09:56:26 +0100
commitd9fda3d247942292a5f24694c22337c547006e11 (patch)
treed1b763e37f3c14a47525d853c69ce48907cba7ee /src/fontfile/filewr.c
parent3b33588117c2ca3099b999939985ffe098d479b3 (diff)
Set close-on-exec for font file I/O.
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
Diffstat (limited to 'src/fontfile/filewr.c')
-rw-r--r--src/fontfile/filewr.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/fontfile/filewr.c b/src/fontfile/filewr.c
index bcc7b1e..859a0be 100644
--- a/src/fontfile/filewr.c
+++ b/src/fontfile/filewr.c
@@ -33,17 +33,19 @@ in this Software without prior written authorization from The Open Group.
#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);