]> git.e2factory.org Git - e2factory.git/commitdiff
e2lib: handle read EINTR in poll loop
authorTobias Ulmer <tu@emlix.com>
Wed, 13 Feb 2019 17:50:12 +0000 (18:50 +0100)
committerTobias Ulmer <tu@emlix.com>
Wed, 13 Feb 2019 17:50:15 +0000 (18:50 +0100)
Maybe eio.read() should generally loop on EINTR?

Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/e2lib.lua

index 24af52a420dd4756f4b0464cab99f7e4f22d4f25..75efc4ff196a293ab3658fc630b05b2c5c03002b 100644 (file)
@@ -1357,11 +1357,15 @@ function e2lib.callcmd(argv, fdctv, workdir, envdict, nowait)
                 if ptab.POLLIN then
                     fdct = fd_find_writefunc_by_readfd(fdctv, ptab.fd)
                     if fdct then
-                        local data
+                        local data, eno
 
-                        data, re = eio.read(fdct._p.rfd, 4096)
+                        data, re, eno = eio.read(fdct._p.rfd, 4096)
                         if not data then
-                            return false, re
+                            if eno ~= errno.def2errnum("EINTR") then
+                                return false, re
+                            end
+                            e2lib.logf(4, "poll loop read: fd=%d -> EINTR",
+                                fdct._p.rfd)
                         elseif data ~= "" then
                             if fdct.linebuffer then
                                 fd_linebuffer(fdct, data)