elock.h: add possibility to create recursive mutexes
[enigma2.git] / lib / base / buffer.cpp
index 9839b3e8536597a7f3cf9c894ddfe09e3c7d6762..5dfdfad5d6c8c65fa1f15f7d0e5710ba830230a2 100644 (file)
@@ -1,8 +1,9 @@
 #include <lib/base/buffer.h>
 #include <lib/base/eerror.h>
-#include <stdio.h>
+#include <cerrno>
+#include <cstdio>
+#include <cstring>
 #include <unistd.h>
-#include <errno.h>
 
 void eIOBuffer::removeblock()
 {
@@ -127,8 +128,11 @@ int eIOBuffer::fromfile(int fd, int len)
                        tc=allocationsize-buffer.back().len;
                r=::read(fd, buffer.back().data+buffer.back().len, tc);
                buffer.back().len+=r;
-               if (r < 0 && errno != EWOULDBLOCK )
-                       eDebug("couldn't read: %m");
+               if (r < 0)
+               {
+                       if (errno != EWOULDBLOCK && errno != EBUSY && errno != EINTR)
+                               eDebug("couldn't read: %m");
+               }
                else
                {
                        len-=r;
@@ -155,7 +159,7 @@ int eIOBuffer::tofile(int fd, int len)
                w=::write(fd, buffer.front().data+ptr, tc);
                if (w < 0)
                {
-                       if (errno != EWOULDBLOCK)
+                       if (errno != EWOULDBLOCK && errno != EBUSY && errno != EINTR)
                                eDebug("write: %m");
                        w=0;
                }