[FFmpeg-cvslog] r26075 - trunk/libavutil/file.c

stefano subversion
Wed Dec 22 17:16:31 CET 2010


Author: stefano
Date: Wed Dec 22 17:16:31 2010
New Revision: 26075

Log:
Fix av_file_map(): replace stat(filename, &st) with fstat(fd, &st).

The file might be replaced between open() and stat().
Spotted by Mans.

Modified:
   trunk/libavutil/file.c

Modified: trunk/libavutil/file.c
==============================================================================
--- trunk/libavutil/file.c	Wed Dec 22 16:32:13 2010	(r26074)
+++ trunk/libavutil/file.c	Wed Dec 22 17:16:31 2010	(r26075)
@@ -54,10 +54,10 @@ int av_file_map(const char *filename, ui
         return err;
     }
 
-    if (stat(filename, &st) < 0) {
+    if (fstat(fd, &st) < 0) {
         err = AVERROR(errno);
         av_strerror(err, errbuf, sizeof(errbuf));
-        av_log(&file_log_ctx, AV_LOG_ERROR, "Error occurred in lstat(): %s\n", errbuf);
+        av_log(&file_log_ctx, AV_LOG_ERROR, "Error occurred in fstat(): %s\n", errbuf);
         close(fd);
         return err;
     }



More information about the ffmpeg-cvslog mailing list