Commit 4396c68b authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

net_Write: always a cancellation point as promised

parent 2932220e
...@@ -428,8 +428,11 @@ ssize_t net_Write( vlc_object_t *p_this, int fd, const v_socket_t *p_vs, ...@@ -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 }, { .fd = vlc_object_waitpipe (p_this), .events = POLLIN },
}; };
if (ufd[1].fd == -1) if (unlikely(ufd[1].fd == -1))
{
vlc_testcancel ();
return -1; return -1;
}
while( i_data > 0 ) 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, ...@@ -486,6 +489,9 @@ ssize_t net_Write( vlc_object_t *p_this, int fd, const v_socket_t *p_vs,
i_total += val; i_total += val;
} }
if (unlikely(i_data == 0))
vlc_testcancel (); /* corner case */
if ((i_total > 0) || (i_data == 0)) if ((i_total > 0) || (i_data == 0))
return i_total; return i_total;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment