[FFmpeg-cvslog] Use MAP_FAILED to check for mmap failure instead of manually

Reimar Döffinger git at videolan.org
Sat May 7 10:41:26 CEST 2011


ffmpeg | branch: master | Reimar Döffinger <Reimar.Doeffinger at gmx.de> | Sat May  7 10:00:03 2011 +0200| [314374e57978bd215ae42d5444f0e76f2bebdc27] | committer: Reimar Döffinger

Use MAP_FAILED to check for mmap failure instead of manually
recreating the value.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=314374e57978bd215ae42d5444f0e76f2bebdc27
---

 libavutil/file.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavutil/file.c b/libavutil/file.c
index 1fb7a2b..ed6fa38 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 (ptr == (void*)-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);



More information about the ffmpeg-cvslog mailing list