From 098438a5ff402a3592ec8437af61213e4f8312f9 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Wed, 29 Jan 2020 22:50:46 +0100 Subject: [PATCH] fb_generic: fix compil warning --- src/driver/fb_generic.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index 2db52bb1e..9734d3229 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -778,7 +778,12 @@ bool CFrameBuffer::paintIcon8(const std::string & filename, const int x, const i return false; } - read(lfd, &header, sizeof(struct rawHeader)); + ssize_t r = read(lfd, &header, sizeof(struct rawHeader)); + if(r <= 0) + { + close(fd); + return false; + } width = (header.width_hi << 8) | header.width_lo; height = (header.height_hi << 8) | header.height_lo; @@ -794,7 +799,11 @@ bool CFrameBuffer::paintIcon8(const std::string & filename, const int x, const i fb_pixel_t *d = getFrameBufferPointer() + x + swidth * y; fb_pixel_t * d2; for (int count=0; count> 1 ); + s = read(lfd, &pixbuf[0], width >> 1 ); + if(s <= 0) + { + break; + } unsigned char *pixpos = &pixbuf[0]; for (int count2 = 0; count2 < width >> 1; count2 ++ ) { unsigned char compressed = *pixpos;