From b7f80de25d701ebbfbcb03ac73c2bb4de0979d90 Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Sun, 10 Jan 2016 14:29:18 +0100 Subject: all: Check for return value of lseek --- src/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index b224e5c..a6994b8 100644 --- a/src/main.c +++ b/src/main.c @@ -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(); -- cgit v1.2.3