all: Check for return value of lseek

This commit is contained in:
Pali Rohár committed 2016-01-10 14:29:18 +01:00
1 parent 1ee86c05f4
commit b7f80de25d
5 files changed
+47 -9

No files matched your search

+4 -1
View File
@@ -212,7 +212,10 @@ static void parse_image_arg(char * arg, struct image_list ** image_first) {
ERROR_INFO("Cannot get size of file %s", layout_file);
exit(1);
}
lseek(fd, 0, SEEK_SET);
if ( lseek(fd, 0, SEEK_SET) == (off_t)-1 ) {
ERROR_INFO("Cannot seek to begin of file %s", layout_file);
exit(1);
}
layout = malloc(len+1);
if ( ! layout ) {
ALLOC_ERROR();