1
0
Fork 0
forked from len0rd/rockbox

Bugfix: SEEK_END takes negative position

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@747 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2002-05-27 12:38:41 +00:00
parent c7036f1f5e
commit aa12eda830

View file

@ -227,15 +227,14 @@ int lseek(int fd, int offset, int whence)
break; break;
case SEEK_END: case SEEK_END:
pos = openfiles[fd].size - offset; pos = openfiles[fd].size + offset;
break; break;
default: default:
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }
if ( (pos < 0) || if ((pos < 0) || (pos > openfiles[fd].size)) {
(pos > openfiles[fd].size) ) {
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }