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

[tyndur-devel] [PATCH v2 6/8] libc: lio_compat_readahead() gefixt



! libc: lio_compat_readahead() darf für den lio_seek()-Rückgabewert
  keine unsigned-Variable nehmen, wenn es auf Fehler prüfen will.

* libc: Benutze nichtblockierendes Read in lio_compat_readahead()

Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
 src/modules/lib/lostio/client/file.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/modules/lib/lostio/client/file.c b/src/modules/lib/lostio/client/file.c
index fabf7bc..9e39f4e 100644
--- a/src/modules/lib/lostio/client/file.c
+++ b/src/modules/lib/lostio/client/file.c
@@ -336,17 +336,18 @@ int lio_compat_eof(io_resource_t* io_res)
 }
 
 /**
- * Liest aus einer Ressource, ohne den Dateizeiger zu verändern
+ * Liest aus einer Ressource, ohne den Dateizeiger zu verändern und ohne zu
+ * blockieren
  */
 ssize_t lio_compat_readahead(void* dest, size_t size, io_resource_t* io_res)
 {
     if (IS_LIO2(io_res)) {
-        uint64_t pos = lio_seek(io_res->lio2_stream, 0, LIO_SEEK_CUR);
+        int64_t pos = lio_seek(io_res->lio2_stream, 0, LIO_SEEK_CUR);
         if (pos < 0) {
             return pos;
         }
 
-        return lio_pread(io_res->lio2_stream, pos, size, dest);
+        return lio_readf(io_res->lio2_stream, pos, size, dest, 0);
     } else {
         return lio1_read_fn(dest, 1, size, io_res, "IO_READA");
     }
-- 
2.1.4