summaryrefslogtreecommitdiff
path: root/test/XpmRead.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/XpmRead.c')
-rw-r--r--test/XpmRead.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/XpmRead.c b/test/XpmRead.c
index df7a826..a231419 100644
--- a/test/XpmRead.c
+++ b/test/XpmRead.c
@@ -33,6 +33,10 @@
#include "TestAllFiles.h"
+#ifndef O_CLOEXEC
+# define O_CLOEXEC 0
+#endif
+
#ifndef g_assert_no_errno /* defined in glib 2.66 & later */
#define g_assert_no_errno(n) g_assert_cmpint(n, >=, 0)
#endif
@@ -147,7 +151,7 @@ TestReadFileToBuffer(const gchar *filepath)
g_assert_nonnull(buffer);
/* Read file ourselves and verify the data matches */
- g_assert_no_errno(fd = open(filepath, O_RDONLY));
+ g_assert_no_errno(fd = open(filepath, O_RDONLY | O_CLOEXEC));
while ((rd = read(fd, readbuf, sizeof(readbuf))) > 0) {
g_assert_cmpmem(b, rd, readbuf, rd);
b += rd;