summaryrefslogtreecommitdiff
path: root/src/XpmI.h
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-03-27 18:35:46 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-04-22 17:15:24 +0000
commit4524c578581b427145ae136844fc655a89e94777 (patch)
tree12d368ed993e0e98786af558bc92e1e39251b5bc /src/XpmI.h
parentf131de92d6c4e2f62934e85b012287276ecf009c (diff)
downloadxorg-lib-libXpm-4524c578581b427145ae136844fc655a89e94777.tar.gz
Set close-on-exec when opening filesHEADmaster
Relies on platforms with O_CLOEXEC support following POSIX requirement to not copy the close-on-exec flag to the new fd in dup2(), but to leave it unset instead, since that's how fd's are passed to child processes to handled compressed files. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src/XpmI.h')
-rw-r--r--src/XpmI.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/XpmI.h b/src/XpmI.h
index 70da79e..4ab48f2 100644
--- a/src/XpmI.h
+++ b/src/XpmI.h
@@ -103,6 +103,13 @@ extern FILE *popen();
# endif
#endif
+#ifdef O_CLOEXEC
+# define FOPEN_CLOEXEC "e"
+#else
+# define FOPEN_CLOEXEC ""
+# define O_CLOEXEC 0
+#endif
+
#define XPMMAXCMTLEN BUFSIZ
typedef struct {
unsigned int type;