[vlc-commits] network/io.c: minor fix

Frédéric Yhuel git at videolan.org
Wed Apr 4 16:26:13 CEST 2012


vlc | branch: master | Frédéric Yhuel <fyhuel at viotech.net> | Wed Apr  4 14:11:58 2012 +0200| [c0e768b8fd8e6405a3864db3b2358c1ccd89a476] | committer: Rémi Denis-Courmont

network/io.c: minor fix

Unlike POLLERR, POLLHUP, and POLLNVAL, POLLRDHUP is not set by default.
See http://man7.org/linux/man-pages/man2/poll.2.html

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 src/network/io.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/network/io.c b/src/network/io.c
index 0d89f10..25dbbfe 100644
--- a/src/network/io.c
+++ b/src/network/io.c
@@ -257,9 +257,12 @@ ssize_t
 net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
           void *restrict p_buf, size_t i_buflen, bool waitall)
 {
+#ifndef POLLRDHUP /* This is nice but non-portable */
+# define POLLRDHUP 0
+#endif
     size_t i_total = 0;
     struct pollfd ufd[2] = {
-        { .fd = fd,                           .events = POLLIN },
+        { .fd = fd,                           .events = POLLIN|POLLRDHUP },
         { .fd = vlc_object_waitpipe (p_this), .events = POLLIN },
     };
 
@@ -277,9 +280,6 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
             continue;
         }
 
-#ifndef POLLRDHUP /* This is nice but non-portable */
-# define POLLRDHUP 0
-#endif
         if (i_total > 0)
         {
             /* Errors (-1) and EOF (0) will be returned on next call,



More information about the vlc-commits mailing list