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/fiasco.c | |
parent | 1ee86c05f4520e859a335ac7e84488aba9033b09 (diff) | |
download | 0xFFFF-b7f80de25d701ebbfbcb03ac73c2bb4de0979d90.tar.bz2 |
all: Check for return value of lseek
Diffstat (limited to 'src/fiasco.c')
-rw-r--r-- | src/fiasco.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/fiasco.c b/src/fiasco.c index 7917385..ba6d262 100644 --- a/src/fiasco.c +++ b/src/fiasco.c @@ -218,6 +218,8 @@ struct fiasco * fiasco_alloc_from_file(const char * file) { READ_OR_RETURN(fiasco, buf, 1); offset = lseek(fiasco->fd, 0, SEEK_CUR); + if ( offset == (off_t)-1 ) + FIASCO_READ_ERROR(fiasco, "Cannot get offset of file"); VERBOSE(" version: %s\n", version); VERBOSE(" device: %s\n", device); @@ -231,7 +233,8 @@ struct fiasco * fiasco_alloc_from_file(const char * file) { fiasco_add_image(fiasco, image); - lseek(fiasco->fd, offset+length, SEEK_SET); + if ( lseek(fiasco->fd, offset+length, SEEK_SET) == (off_t)-1 ) + FIASCO_READ_ERROR(fiasco, "Cannot seek to next image in file"); } |