diff --git a/sortix/bga.cpp b/sortix/bga.cpp index dac62a3d..f73c0e49 100644 --- a/sortix/bga.cpp +++ b/sortix/bga.cpp @@ -380,7 +380,7 @@ ssize_t BGADriver::WriteAt(off_t off, const void* buf, size_t count) if ( (off_t) framesize <= off ) return 0; if ( framesize < off + count ) - count = off - framesize; + count = framesize - off; Maxsi::Memory::Copy(frame + off, buf, count); return count; } @@ -391,7 +391,7 @@ ssize_t BGADriver::ReadAt(off_t off, void* buf, size_t count) if ( (off_t) framesize <= off ) return 0; if ( framesize < off + count ) - count = off - framesize; + count = framesize - off; Maxsi::Memory::Copy(buf, frame + off, count); return count; } diff --git a/sortix/video.cpp b/sortix/video.cpp index 9245832c..2c44d01c 100644 --- a/sortix/video.cpp +++ b/sortix/video.cpp @@ -427,7 +427,7 @@ ssize_t ReadAt(off_t off, void* buf, size_t count) ScopedLock lock(&videolock); DriverEntry* drvent = CurrentDriverEntry(); if ( !drvent ) { Error::Set(EINVAL); return -1; } - return drvent->driver->WriteAt(off, buf, count); + return drvent->driver->ReadAt(off, buf, count); } } // namespace Video