mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 19:45:08 +00:00
FileSystem: fix errno on lseek() beyond the bounds of a file
These are all EINVAL. Also remove bogus assert on metadata.size.
This commit is contained in:
parent
abb7455163
commit
f1f3cd58b0
1 changed files with 3 additions and 3 deletions
|
@ -142,17 +142,17 @@ off_t FileDescriptor::seek(off_t offset, int whence)
|
|||
break;
|
||||
case SEEK_CUR:
|
||||
newOffset = m_current_offset + offset;
|
||||
if (newOffset < 0)
|
||||
return -EINVAL;
|
||||
break;
|
||||
case SEEK_END:
|
||||
ASSERT(metadata.size); // FIXME: What do I do?
|
||||
newOffset = metadata.size;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (newOffset < 0 || newOffset > metadata.size)
|
||||
return -EINVAL;
|
||||
|
||||
m_current_offset = newOffset;
|
||||
return m_current_offset;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue