>From 4fe02b1a909bfea5d53917013535bb72a833d1f3 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <komh@chollian.net>
Date: Mon, 4 Feb 2013 13:24:45 +0900
Subject: [PATCH] vlc_threads: fix the cancelation of vlc_poll()

If timeout is negative, cancelation does not work.
---
 include/vlc_threads.h |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index 337ded4..dfa7222 100644
--- a/include/vlc_threads.h
+++ b/include/vlc_threads.h
@@ -390,12 +390,13 @@ static inline int vlc_poll (struct pollfd *fds, unsigned nfds, int timeout)
 {
     vlc_testcancel ();
 
-    while (timeout > 50)
+    while (timeout < 0 || timeout > 50)
     {
         int val = poll (fds, nfds, 50);
         if (val != 0)
             return val;
-        timeout -= 50;
+        if (timeout > 50)
+            timeout -= 50;
         vlc_testcancel ();
     }
 
-- 
1.7.3.2

