From: RĂ©mi Denis-Courmont Date: Sun, 14 Feb 2010 15:15:09 +0000 (+0200) Subject: net_Write: always a cancellation point as promised X-Git-Tag: 1.1.0-ff~44 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=4396c68b8933a10b1ca4b99092a60c16670f06d3;p=vlc net_Write: always a cancellation point as promised --- diff --git a/src/network/io.c b/src/network/io.c index ab72ebae5d..23d23f1614 100644 --- a/src/network/io.c +++ b/src/network/io.c @@ -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;