]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blobdiff - libavformat/file.c
Started implementation of "correct" O_DIRECT handling
[frescor/ffmpeg.git] / libavformat / file.c
index 402a58e79aaf485aa1a962f109e89aa36dcf754c..5cc887d1c125bcfeddc3b5a28dd55dbcfb73a2e9 100644 (file)
@@ -18,6 +18,7 @@
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
+
 #define _GNU_SOURCE
 #include "libavutil/avstring.h"
 #include "avformat.h"
@@ -43,13 +44,14 @@ static int file_open(URLContext *h, const char *filename, int flags)
     if (flags & URL_RDWR) {
         access = O_CREAT | O_TRUNC | O_RDWR;
     } else if (flags & URL_WRONLY) {
-        access = O_CREAT | O_TRUNC | O_WRONLY | O_DIRECT;
+        access = O_CREAT | O_TRUNC | O_WRONLY;
     } else {
         access = O_RDONLY;
     }
 #ifdef O_BINARY
     access |= O_BINARY;
 #endif
+    access |= O_DIRECT;
     fd = open(filename, access, 0666);
     if (fd < 0)
         return AVERROR(ENOENT);