fix check mmap error, avoid possible segment fault

Origin commit data
------------------
Branch: master
Commit: 7d5b7d9279
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2019-04-16 (Tue, 16 Apr 2019)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2019-04-16 23:15:57 +02:00
committed by vanhofen
parent 711a080996
commit f8a6890f55

View File

@@ -1066,7 +1066,6 @@ void get_osd_size(int &xres, int &yres, int &bits_per_pixel)
}
void get_osd_buf(unsigned char *osd_data)
{
unsigned char *lfb = NULL;
struct fb_fix_screeninfo fix_screeninfo;
struct fb_var_screeninfo var_screeninfo;
@@ -1091,7 +1090,8 @@ void get_osd_buf(unsigned char *osd_data)
return;
}
if(!(lfb = (unsigned char*)mmap(0, fix_screeninfo.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fb, 0)))
void *lfb = (unsigned char*)mmap(0, fix_screeninfo.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fb, 0);
if(lfb == MAP_FAILED)
{
fprintf(stderr, "Framebuffer: <Memmapping failed>\n");
close(fb);