mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-24 08:12:44 +00:00
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
This commit is contained in:
parent
1b31037d62
commit
f02cbc4590
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user