Fix reading /dev/video/fb causing a write instead.

This really fucks stuff up.
This commit is contained in:
Jonas 'Sortie' Termansen 2012-09-08 19:40:22 +02:00
parent c9eb1b2cb3
commit b0807e8c7a
2 changed files with 3 additions and 3 deletions

View File

@ -380,7 +380,7 @@ ssize_t BGADriver::WriteAt(off_t off, const void* buf, size_t count)
if ( (off_t) framesize <= off ) if ( (off_t) framesize <= off )
return 0; return 0;
if ( framesize < off + count ) if ( framesize < off + count )
count = off - framesize; count = framesize - off;
Maxsi::Memory::Copy(frame + off, buf, count); Maxsi::Memory::Copy(frame + off, buf, count);
return count; return count;
} }
@ -391,7 +391,7 @@ ssize_t BGADriver::ReadAt(off_t off, void* buf, size_t count)
if ( (off_t) framesize <= off ) if ( (off_t) framesize <= off )
return 0; return 0;
if ( framesize < off + count ) if ( framesize < off + count )
count = off - framesize; count = framesize - off;
Maxsi::Memory::Copy(buf, frame + off, count); Maxsi::Memory::Copy(buf, frame + off, count);
return count; return count;
} }

View File

@ -427,7 +427,7 @@ ssize_t ReadAt(off_t off, void* buf, size_t count)
ScopedLock lock(&videolock); ScopedLock lock(&videolock);
DriverEntry* drvent = CurrentDriverEntry(); DriverEntry* drvent = CurrentDriverEntry();
if ( !drvent ) { Error::Set(EINVAL); return -1; } if ( !drvent ) { Error::Set(EINVAL); return -1; }
return drvent->driver->WriteAt(off, buf, count); return drvent->driver->ReadAt(off, buf, count);
} }
} // namespace Video } // namespace Video