We can't use "int" to caputre output of lseek which is "loff_t", since former does not cover all of the range of the values of the latter and any pos >= 0xffff_ffff will result in a false positive "failure". To avoid that replace the check to check that new position matches what was requested. Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx> --- lib/libfile.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/libfile.c b/lib/libfile.c index 8f2aed230..9a223d232 100644 --- a/lib/libfile.c +++ b/lib/libfile.c @@ -556,8 +556,7 @@ int open_and_lseek(const char *filename, int mode, loff_t pos) } } - ret = lseek(fd, pos, SEEK_SET); - if (ret == -1) { + if (lseek(fd, pos, SEEK_SET) != pos) { perror("lseek"); close(fd); return -errno; -- 2.20.1 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox