File libraw1394.eventloop-return.patch of Package libraw1394

r177 | ddennedy | 2008-03-27 21:25:23 +0100 (Thu, 27 Mar 2008) | 4 lines
Changed paths:
   M /trunk/src/eventloop.c

eventloop.c: apply patch from Jonas Bonn to retry read when failed with EINTR.
This can occur when libraw1394 caller receives a signal while in this read and
the caller is not using a signal handler set with signal().

---
 src/eventloop.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/src/eventloop.c
+++ b/src/eventloop.c
@@ -21,6 +21,7 @@
 #include <config.h>
 #include <unistd.h>
 #include <byteswap.h>
+#include <errno.h>
 
 #include "raw1394.h"
 #include "kernel-raw1394.h"
@@ -32,8 +33,8 @@ int raw1394_loop_iterate(struct raw1394_
         struct raw1394_request req;
         int retval = 0, channel;
 
-        if (read(handle->fd, &req, sizeof(req)) < 0) {
-                return -1;
+        while (read(handle->fd, &req, sizeof(req)) < 0) {
+                if (errno != EINTR) return -1;
         }
 
         switch (req.type) {
openSUSE Build Service is sponsored by