]> git.sesse.net Git - vlc/commitdiff
net_Write: always a cancellation point as promised
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 14 Feb 2010 15:15:09 +0000 (17:15 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 14 Feb 2010 15:15:09 +0000 (17:15 +0200)
src/network/io.c

index ab72ebae5dddf4edd52626a06ace90dd6e8efa37..23d23f161427059c4836956fd32814751dbfb725 100644 (file)
@@ -428,8 +428,11 @@ ssize_t net_Write( vlc_object_t *p_this, int fd, const v_socket_t *p_vs,
         { .fd = vlc_object_waitpipe (p_this), .events = POLLIN  },
     };
 
-    if (ufd[1].fd == -1)
+    if (unlikely(ufd[1].fd == -1))
+    {
+        vlc_testcancel ();
         return -1;
+    }
 
     while( i_data > 0 )
     {
@@ -486,6 +489,9 @@ ssize_t net_Write( vlc_object_t *p_this, int fd, const v_socket_t *p_vs,
         i_total += val;
     }
 
+    if (unlikely(i_data == 0))
+        vlc_testcancel (); /* corner case */
+
     if ((i_total > 0) || (i_data == 0))
         return i_total;