Le 2014-09-18 07:13, Reinhard Tartler a écrit :
From: Michael Niedermayer <[email protected]>

Fixes CID1087079
Signed-off-by: Reinhard Tartler <[email protected]>
---
 libavutil/file_open.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavutil/file_open.c b/libavutil/file_open.c
index 765eb60..019eec5 100644
--- a/libavutil/file_open.c
+++ b/libavutil/file_open.c
@@ -19,6 +19,7 @@
 #include "config.h"
 #include "internal.h"
 #include "mem.h"
+#include "log.h"
 #include <stdarg.h>
 #include <fcntl.h>
 #include <sys/stat.h>
@@ -85,8 +86,10 @@ int avpriv_open(const char *filename, int flags, ...)

     fd = open(filename, flags, mode);
 #if HAVE_FCNTL
-    if (fd != -1)
-        fcntl(fd, F_SETFD, FD_CLOEXEC);
+    if (fd != -1) {
+        if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
+ av_log(NULL, AV_LOG_DEBUG, "Failed to set close on exec\n");
+    }

IMNSHO, the correct solution is to force O_CLOEXEC in the open flags. I'm quite surprised that this issue is still there, because I'm pretty sure I sent a series of patch to fix close-on-exec.

Then either drop the fcntl() call where O_CLOEXEC is supported, or leave it as it is since it really cannot fail. Adding an error message is not going to help at all.

--
Rémi Denis-Courmont
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to