From 4f65416bd16b9dfd0f4b9939070e8cf3a65646b3 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 21 Nov 2004 14:37:36 +0100 Subject: [PATCH] Some improvements to cPoller --- CONTRIBUTORS | 1 + HISTORY | 3 ++- tools.c | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index e13b6c08..0ee05623 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1087,6 +1087,7 @@ Marco Schl for fixing cRemux::ScanVideoPacket() to make sure it doesn't access memory beyond the end of the given buffer, which has caused some unjustified "unknown picture type errors" + for some improvements to cPoller Jürgen Schmitz for reporting a bug in displaying the current channel when switching via the SVDRP diff --git a/HISTORY b/HISTORY index 3e956527..8bb77e92 100644 --- a/HISTORY +++ b/HISTORY @@ -3139,7 +3139,7 @@ Video Disk Recorder Revision History days ('1' is monday). Thanks to Sascha Klek for reporting a problem with the '0' key in the "Day" item of the "Timers" menu. -2004-11-20: Version 1.3.17 +2004-11-21: Version 1.3.17 - Fixed cRemux::ScanVideoPacket() to make sure it doesn't access memory beyond the end of the given buffer, which has caused some unjustified "unknown @@ -3158,3 +3158,4 @@ Video Disk Recorder Revision History to Stefan Huelswitt for pointing this out). - Fixed toggling the "Day" item in the "Timers" menu, so that it selects the right day of week for timers in the future. +- Some improvements to cPoller (thanks to Marco Schlüßler). diff --git a/tools.c b/tools.c index ecb57c31..41d0c725 100644 --- a/tools.c +++ b/tools.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.c 1.81 2004/10/31 16:42:36 kls Exp $ + * $Id: tools.c 1.82 2004/11/21 14:36:34 kls Exp $ */ #include "tools.h" @@ -532,12 +532,13 @@ bool cPoller::Add(int FileHandle, bool Out) { if (FileHandle >= 0) { for (int i = 0; i < numFileHandles; i++) { - if (pfd[i].fd == FileHandle) + if (pfd[i].fd == FileHandle && pfd[i].events == (Out ? POLLOUT : POLLIN)) return true; } if (numFileHandles < MaxPollFiles) { pfd[numFileHandles].fd = FileHandle; pfd[numFileHandles].events = Out ? POLLOUT : POLLIN; + pfd[numFileHandles].revents = 0; numFileHandles++; return true; }