forked from enlightenment/efl
Check return value of lseek call for errors.
NB: Fixes Coverity CID 1040029 Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
73a68f2f0d
commit
9d60d6ccff
|
@ -885,7 +885,17 @@ compile(void)
|
|||
}
|
||||
DBG("Opening \"%s\" for input", file_in);
|
||||
|
||||
/* lseek can return -1 on error. trap that return and exit so that
|
||||
* we do not pass malloc a -1
|
||||
*
|
||||
* NB: Fixes Coverity CID 1040029 */
|
||||
size = lseek(fd, 0, SEEK_END);
|
||||
if (size < 0)
|
||||
{
|
||||
ERR("Cannot read file \"%s\". %s", file_in, strerror(errno));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
data = malloc(size);
|
||||
if (data && (read(fd, data, size) == size))
|
||||
|
|
Loading…
Reference in New Issue