Some improvements to cPoller

This commit is contained in:
Klaus Schmidinger 2004-11-21 14:37:36 +01:00
parent 0d63ccef21
commit 4f65416bd1
3 changed files with 6 additions and 3 deletions

View File

@ -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 <j.schmitz@web.de>
for reporting a bug in displaying the current channel when switching via the SVDRP

View File

@ -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).

View File

@ -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;
}