Index: src/OFKernelEventObserver_select.m ================================================================== --- src/OFKernelEventObserver_select.m +++ src/OFKernelEventObserver_select.m @@ -26,10 +26,12 @@ #import "OFKernelEventObserver.h" #import "OFKernelEventObserver+Private.h" #import "OFKernelEventObserver_select.h" #import "OFArray.h" +#import "OFOutOfRangeException.h" + #import "socket_helpers.h" @implementation OFKernelEventObserver_select - init { @@ -43,25 +45,37 @@ return self; } - (void)OF_addFileDescriptorForReading: (int)fd { + if (fd >= FD_SETSIZE) + @throw [OFOutOfRangeException exception]; + FD_SET(fd, &_readFDs); } - (void)OF_addFileDescriptorForWriting: (int)fd { + if (fd >= FD_SETSIZE) + @throw [OFOutOfRangeException exception]; + FD_SET(fd, &_writeFDs); } - (void)OF_removeFileDescriptorForReading: (int)fd { + if (fd >= FD_SETSIZE) + @throw [OFOutOfRangeException exception]; + FD_CLR(fd, &_readFDs); } - (void)OF_removeFileDescriptorForWriting: (int)fd { + if (fd >= FD_SETSIZE) + @throw [OFOutOfRangeException exception]; + FD_CLR(fd, &_writeFDs); } - (bool)observeForTimeInterval: (of_time_interval_t)timeInterval {