summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2016-01-10 14:29:18 +0100
committerPali Rohár <pali.rohar@gmail.com>2016-01-10 14:29:18 +0100
commitb7f80de25d701ebbfbcb03ac73c2bb4de0979d90 (patch)
treef8ee25ad36ce84cce95f0ab461bdd81bee2495ba /src/main.c
parent1ee86c05f4520e859a335ac7e84488aba9033b09 (diff)
download0xFFFF-b7f80de25d701ebbfbcb03ac73c2bb4de0979d90.tar.bz2
all: Check for return value of lseek
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c5
1 files changed, 4 insertions, 1 deletions
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();