[libbluray-devel] retry when pread() is interrupted

Petri Hintukainen git at videolan.org
Sun Mar 29 18:17:53 CEST 2015


libudfread | branch: master | Petri Hintukainen <phintuka at gmail.com> | Sun Mar 29 19:11:38 2015 +0300| [b09ef7d8e9a886b37084bfd9570a17c1a7e65c27] | committer: Petri Hintukainen

retry when pread() is interrupted

> http://git.videolan.org/gitweb.cgi/libudfread.git/?a=commit;h=b09ef7d8e9a886b37084bfd9570a17c1a7e65c27
---

 src/default_blockinput.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/default_blockinput.c b/src/default_blockinput.c
index 9aae199..18061fa 100644
--- a/src/default_blockinput.c
+++ b/src/default_blockinput.c
@@ -26,6 +26,7 @@
 #include "default_blockinput.h"
 #include "blockinput.h"
 
+#include <errno.h>
 #include <stdlib.h>
 #include <stdlib.h>
 #ifdef HAVE_UNISTD_H
@@ -113,6 +114,9 @@ static int _def_read(udfread_block_input *p_gen, uint32_t lba, void *buf, uint32
         ssize_t ret = pread(p->fd, ((char*)buf) + got, bytes - got, pos + got);
 
         if (ret <= 0) {
+            if (ret < 0 && errno == EINTR) {
+                continue;
+            }
             if (got < UDF_BLOCK_SIZE) {
                 return ret;
             }



More information about the libbluray-devel mailing list