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

[Lost] [Patch] lostio: Fix für Antwortgröße in ramfile_read()



Der angehängte Patch fixt für mich Bug #44.
Index: src/modules/lib/lostio/types/ramfile.c
===================================================================
--- src/modules/lib/lostio/types/ramfile.c	(Revision 638)
+++ src/modules/lib/lostio/types/ramfile.c	(Arbeitskopie)
@@ -81,12 +81,14 @@
 read_hdl_reply ramfile_read(lostio_filehandle_t* filehandle, size_t blocksize, size_t blockcount)
 {
     read_hdl_reply reply;
+    size_t remaining = filehandle->node->size - filehandle->pos;
+
     reply.data = filehandle->node->data + filehandle->pos;
 
     //Ueberpruefen, ob die angegebene Groesse > Dateigroesse
-    if(blocksize * blockcount > filehandle->node->size)
+    if(blocksize * blockcount > remaining)
     {
-        reply.size = filehandle->node->size;
+        reply.size = remaining;
     }
     else
     {