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:
parent
c7036f1f5e
commit
aa12eda830
1 changed files with 2 additions and 3 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue