Module: libav Branch: master Commit: d0989bed226578a8f37ca90c78abc97abafb9794
Author: Mans Rullgard <[email protected]> Committer: Mans Rullgard <[email protected]> Date: Sat Jun 4 13:36:35 2011 +0100 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 <[email protected]> --- libavutil/file.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libavutil/file.c b/libavutil/file.c index 3dcce7c..f0e48b5 100644 --- a/libavutil/file.c +++ b/libavutil/file.c @@ -75,7 +75,7 @@ int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, #if HAVE_MMAP 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); _______________________________________________ libav-commits mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-commits
