mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-02 07:28:21 +00:00
seek: actually act properly
This commit is contained in:
@@ -44,24 +44,10 @@ syscallret syscall_lseek(int ifd, off_t offset, int whence){
|
|||||||
|
|
||||||
switch(whence){
|
switch(whence){
|
||||||
case SEEK_SET:
|
case SEEK_SET:
|
||||||
if(offset < 0 || offset > fsize){
|
|
||||||
retv.errno = EINVAL;
|
|
||||||
goto _ret;
|
|
||||||
}
|
|
||||||
newoffset = offset;
|
newoffset = offset;
|
||||||
break;
|
break;
|
||||||
case SEEK_CUR:
|
case SEEK_CUR:
|
||||||
newoffset += offset;
|
newoffset += offset;
|
||||||
if(offset == 0){
|
|
||||||
retv.errno = 0;
|
|
||||||
retv.ret = fd->offset;
|
|
||||||
goto _ret;
|
|
||||||
}
|
|
||||||
if(newoffset < 0 || newoffset > fsize){
|
|
||||||
retv.errno = EINVAL;
|
|
||||||
goto _ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(newoffset < offset){
|
if(newoffset < offset){
|
||||||
retv.errno = EOVERFLOW;
|
retv.errno = EOVERFLOW;
|
||||||
goto _ret;
|
goto _ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user