From aa12eda830f688659b93ab0acf6f9d68a626eff6 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Mon, 27 May 2002 12:38:41 +0000 Subject: Bugfix: SEEK_END takes negative position git-svn-id: svn://svn.rockbox.org/rockbox/trunk@747 a1c6a512-1295-4272-9138-f99709370657 --- firmware/common/file.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/firmware/common/file.c b/firmware/common/file.c index 4b7865d724..38ae3cb912 100644 --- a/firmware/common/file.c +++ b/firmware/common/file.c @@ -227,15 +227,14 @@ int lseek(int fd, int offset, int whence) break; case SEEK_END: - pos = openfiles[fd].size - offset; + pos = openfiles[fd].size + offset; break; default: errno = EINVAL; return -1; } - if ( (pos < 0) || - (pos > openfiles[fd].size) ) { + if ((pos < 0) || (pos > openfiles[fd].size)) { errno = EINVAL; return -1; } -- cgit v1.2.3