diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-12-22 16:16:31 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-12-22 16:16:31 +0000 |
commit | f02cbc4590b31de98b97d376686be148d078143d (patch) | |
tree | 60f6b1ab61a2551aeca6eb2291988df315a672c4 | |
parent | 1b31037d625c1e9c09d02190e74452f3925485f6 (diff) | |
download | ffmpeg-streaming-f02cbc4590b31de98b97d376686be148d078143d.zip ffmpeg-streaming-f02cbc4590b31de98b97d376686be148d078143d.tar.gz |
Fix av_file_map(): replace stat(filename, &st) with fstat(fd, &st).
The file might be replaced between open() and stat().
Spotted by Mans.
Originally committed as revision 26075 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavutil/file.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavutil/file.c b/libavutil/file.c index b325149..1ccb692 100644 --- a/libavutil/file.c +++ b/libavutil/file.c @@ -54,10 +54,10 @@ int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, 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; } |