[FFmpeg-cvslog] av_tempfile: use O_EXCL

Michael Niedermayer git at videolan.org
Sun Oct 16 21:55:12 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Oct 16 21:25:07 2011 +0200| [4105335c98dfafa848fd025f5b3ca4e7b8964d27] | committer: Michael Niedermayer

av_tempfile: use O_EXCL

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4105335c98dfafa848fd025f5b3ca4e7b8964d27
---

 libavutil/file.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libavutil/file.c b/libavutil/file.c
index 44d2ca4..e73e8ef 100644
--- a/libavutil/file.c
+++ b/libavutil/file.c
@@ -152,7 +152,10 @@ int av_tempfile(const char *prefix, char **filename) {
 #   ifndef O_BINARY
 #       define O_BINARY 0
 #   endif
-    fd = open(*filename, O_RDWR | O_BINARY | O_CREAT, 0444);
+#   ifndef O_EXCL
+#       define O_EXCL 0
+#   endif
+    fd = open(*filename, O_RDWR | O_BINARY | O_CREAT | O_EXCL, 0444);
 #else
     snprintf(*filename, len, "/tmp/%sXXXXXX", prefix);
     fd = mkstemp(*filename);



More information about the ffmpeg-cvslog mailing list