summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-03-28 11:55:59 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-03-28 11:55:59 -0700
commit2408433404732b146bf41a2451d23ffadad5a816 (patch)
tree8f3009c5ad0bba3854f74edf9c6d82b03917a4c7
parent0aa003e3d897d2d5bdaac1af404d3e23c76268ec (diff)
downloadxorg-lib-libfontenc-master.tar.gz
Set close-on-exec when opening filesHEADmaster
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/encparse.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/encparse.c b/src/encparse.c
index 7c29628..bf9ea23 100644
--- a/src/encparse.c
+++ b/src/encparse.c
@@ -37,6 +37,14 @@ THE SOFTWARE.
#include <stdlib.h>
+#include <fcntl.h>
+#ifdef O_CLOEXEC
+#define FOPEN_CLOEXEC "e"
+#else
+#define FOPEN_CLOEXEC ""
+#endif
+
+
#include "zlib.h"
typedef gzFile FontFilePtr;
@@ -889,7 +897,7 @@ FontEncReallyReallyLoad(const char *charset,
/* As we don't really expect to open encodings that often, we don't
take the trouble of caching encodings directories. */
- if ((file = fopen(dirname, "r")) == NULL) {
+ if ((file = fopen(dirname, "r" FOPEN_CLOEXEC)) == NULL) {
return NULL;
}