---
 libavutil/file.c        | 5 ++++-
 libavutil/random_seed.c | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavutil/file.c b/libavutil/file.c
index ce02487..a4f9e91 100644
--- a/libavutil/file.c
+++ b/libavutil/file.c
@@ -33,6 +33,9 @@
 #elif HAVE_MAPVIEWOFFILE
 #include <windows.h>
 #endif
+#ifndef O_CLOEXEC
+# define O_CLOEXEC 0
+#endif
 
 typedef struct {
     const AVClass *class;
@@ -49,7 +52,7 @@ int av_file_map(const char *filename, uint8_t **bufptr, 
size_t *size,
                 int log_offset, void *log_ctx)
 {
     FileLogContext file_log_ctx = { &file_log_ctx_class, log_offset, log_ctx };
-    int err, fd = open(filename, O_RDONLY);
+    int err, fd = open(filename, O_RDONLY|O_CLOEXEC);
     struct stat st;
     av_unused void *ptr;
     off_t off_size;
diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c
index ec9caa7..b5a28d9 100644
--- a/libavutil/random_seed.c
+++ b/libavutil/random_seed.c
@@ -32,11 +32,14 @@
 #include <time.h>
 #include "timer.h"
 #include "random_seed.h"
+#ifndef O_CLOEXEC
+# define O_CLOEXEC 0
+#endif
 
 static int read_random(uint32_t *dst, const char *file)
 {
 #if HAVE_UNISTD_H
-    int fd = open(file, O_RDONLY);
+    int fd = open(file, O_RDONLY|O_CLOEXEC);
     int err = -1;
 
     if (fd == -1)
-- 
1.8.4.rc1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to