Fix mmap(2) error check

Bernhard Praschinger <[email protected]> Sun, 3 Dec 2017 17:38:51 +0100
Newsgroups gmane.comp.video.mjpeg.devel
Message-ID <[email protected]>
Hallo

I did just add a patch for a error check from Michael McConville to the 
SVN. Seem's that there is a problem with the mailing list, because of 
that he sent the mail to me. I will investigate the problem.

His mail ist below.

Regards, Bernhard

From: Michael McConville <[email protected]>
Subject: Fix mmap(2) error check
Date: November 30, 2017 at 11:19:34 AM MST
To: [email protected]

Hi guys.

Below is a patch to fix an error check for mmap(2), which returns 
MAP_FAILED rather than NULL on failure.

Thanks for your time!

Michael McConville
University of Utah

Index: lavtools/liblavrec.c
===================================================================
--- lavtools/liblavrec.c        (revision 3413)
+++ lavtools/liblavrec.c        (working copy)
@@ -1308,7 +1308,7 @@
          }
          settings->YUVP_convert[loop].mmap=mmap( 0, size, 
PROT_READ|PROT_WRITE, MAP_SHARED, settings->video_fd,
                                                offset );
-          if( settings->YUVP_convert[loop].mmap == NULL )
+          if( settings->YUVP_convert[loop].mmap == MAP_FAILED )
          {
              lavrec_msg (LAVREC_MSG_ERROR, info,
                 "Packed YUV mmap error");

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot