summaryrefslogtreecommitdiff
path: root/libavutil/file.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-16 21:25:07 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-16 21:51:28 +0200
commit4105335c98dfafa848fd025f5b3ca4e7b8964d27 (patch)
tree5d2949f34c808e8ed34448655d12cbffa5c44942 /libavutil/file.c
parent797c2ef97036bb1e5546e27132af9900168066e5 (diff)
av_tempfile: use O_EXCL
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/file.c')
-rw-r--r--libavutil/file.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavutil/file.c b/libavutil/file.c
index 44d2ca444a..e73e8efd0e 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);