[vlc-devel] commit: accept: ignore interrupts ( Rémi Denis-Courmont )

git version control git at videolan.org
Thu Jun 12 19:20:11 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Thu Jun 12 20:22:03 2008 +0300| [0ad8477b20fb8400808a7fd6148684f0960c0403]

accept: ignore interrupts

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0ad8477b20fb8400808a7fd6148684f0960c0403
---

 src/network/tcp.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/network/tcp.c b/src/network/tcp.c
index 9254729..e027e27 100644
--- a/src/network/tcp.c
+++ b/src/network/tcp.c
@@ -249,7 +249,11 @@ next_ai: /* failure */
 
 int net_AcceptSingle (vlc_object_t *obj, int lfd)
 {
-    int fd = accept (lfd, NULL, NULL);
+    int fd;
+    do
+        fd = accept (lfd, NULL, NULL);
+    while (fd == -1 && errno == EINTR);
+
     if (fd == -1)
     {
         if (net_errno != EAGAIN)
@@ -298,10 +302,13 @@ int __net_Accept( vlc_object_t *p_this, int *pi_fd, mtime_t i_wait )
         switch (poll (ufd, n, timeout))
         {
             case -1:
-                if (net_errno != EINTR)
-                    msg_Err (p_this, "poll error: %m");
+                if (net_errno == EINTR)
+                    continue;
+                msg_Err (p_this, "poll error: %m");
+                return -1;
             case 0:
-                return -1; /* NOTE: p_this already unlocked */
+                errno = ETIMEDOUT;
+                return -1;
         }
 
         if (ufd[n].revents)




More information about the vlc-devel mailing list