[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tyndur-devel] [PATCH v3 5/5] cdi/storage: EOF setzen



! cdi/storage: Wenn ueber das Ende des Geraets hinausgelesen wird, EOF setzen
---
 src/modules/cdi/lib/storage.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/modules/cdi/lib/storage.c b/src/modules/cdi/lib/storage.c
index 88a4528..992ae00 100644
--- a/src/modules/cdi/lib/storage.c
+++ b/src/modules/cdi/lib/storage.c
@@ -238,6 +238,10 @@ static size_t lostio_mst_read_handler(lostio_filehandle_t* fh,
     // Groesse anpassen, wenn ueber das Medium hinaus gelesen werden soll
     if (size > (device->block_count * device->block_size - fh->pos)) {
         size = device->block_count * device->block_size - fh->pos;
+        if (size == 0) {
+            fh->flags |= LOSTIO_FLAG_EOF;
+            return 0;
+        }
     }
 
     // In den uebergebenen Buffer einlesen
-- 
1.5.4.5