[FFmpeg-devel] [PATCH 3/9] lavf/file: implement EXCL flag.

Nicolas George george at nsup.org
Wed Apr 16 18:58:26 CEST 2014


Signed-off-by: Nicolas George <george at nsup.org>
---
 libavformat/file.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/file.c b/libavformat/file.c
index 6511328..89437c7 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -153,6 +153,10 @@ static int file_open(URLContext *h, const char *filename, int flags)
     } else {
         access = O_RDONLY;
     }
+#ifdef O_EXCL
+    if ((access & O_CREAT) && (flags & AVIO_FLAG_EXCL))
+        access |= O_EXCL;
+#endif
 #ifdef O_BINARY
     access |= O_BINARY;
 #endif
@@ -200,6 +204,9 @@ URLProtocol ff_file_protocol = {
     .url_check           = file_check,
     .priv_data_size      = sizeof(FileContext),
     .priv_data_class     = &file_class,
+#ifdef O_EXCL
+    .flags               = URL_PROTOCOL_FLAG_EXCL,
+#endif
 };
 
 #endif /* CONFIG_FILE_PROTOCOL */
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list