From b0807e8c7a7c5b0fa5c7b57347056ce020e17db6 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Sat, 8 Sep 2012 19:40:22 +0200 Subject: [PATCH] Fix reading /dev/video/fb causing a write instead. This really fucks stuff up. --- sortix/bga.cpp | 4 ++-- sortix/video.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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