mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-24 03:39:45 +00:00
Fix error check in av_file_map()
On failure, mmap() returns MAP_FAILED, which may or may not be -1. Signed-off-by: Mans Rullgard <mans@mansr.com>
This commit is contained in:
parent
dc6632f119
commit
d0989bed22
@ -75,7 +75,7 @@ int av_file_map(const char *filename, uint8_t **bufptr, size_t *size,
|
|||||||
|
|
||||||
#if HAVE_MMAP
|
#if HAVE_MMAP
|
||||||
ptr = mmap(NULL, *size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
|
ptr = mmap(NULL, *size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
|
||||||
if ((int)(ptr) == -1) {
|
if (ptr == MAP_FAILED) {
|
||||||
err = AVERROR(errno);
|
err = AVERROR(errno);
|
||||||
av_strerror(err, errbuf, sizeof(errbuf));
|
av_strerror(err, errbuf, sizeof(errbuf));
|
||||||
av_log(&file_log_ctx, AV_LOG_ERROR, "Error occurred in mmap(): %s\n", errbuf);
|
av_log(&file_log_ctx, AV_LOG_ERROR, "Error occurred in mmap(): %s\n", errbuf);
|
||||||
|
Loading…
Reference in New Issue
Block a user