Commit d0989bed authored by Mans Rullgard's avatar Mans Rullgard
Browse files

Fix error check in av_file_map()

On failure, mmap() returns MAP_FAILED, which may or may not be -1.
Signed-off-by: default avatarMans Rullgard <>
parent dc6632f1
......@@ -75,7 +75,7 @@ int av_file_map(const char *filename, uint8_t **bufptr, size_t *size,
ptr = mmap(NULL, *size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
if ((int)(ptr) == -1) {
if (ptr == MAP_FAILED) {
err = AVERROR(errno);
av_strerror(err, errbuf, sizeof(errbuf));
av_log(&file_log_ctx, AV_LOG_ERROR, "Error occurred in mmap(): %s\n", errbuf);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment