diff options
author | Pali Rohár <pali.rohar@gmail.com> | 2016-01-10 14:29:18 +0100 |
---|---|---|
committer | Pali Rohár <pali.rohar@gmail.com> | 2016-01-10 14:29:18 +0100 |
commit | b7f80de25d701ebbfbcb03ac73c2bb4de0979d90 (patch) | |
tree | f8ee25ad36ce84cce95f0ab461bdd81bee2495ba /src/main.c | |
parent | 1ee86c05f4520e859a335ac7e84488aba9033b09 (diff) | |
download | 0xFFFF-b7f80de25d701ebbfbcb03ac73c2bb4de0979d90.tar.bz2 |
all: Check for return value of lseek
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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(); |