From 4396c68b8933a10b1ca4b99092a60c16670f06d3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Sun, 14 Feb 2010 17:15:09 +0200 Subject: [PATCH] net_Write: always a cancellation point as promised --- src/network/io.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; -- 2.39.5