Fix a segfault in rTorrent when running a large number of torrents.
From Tobias Ulmer; ok espie@
This commit is contained in:
parent
ffa3232502
commit
03f208dc46
@ -1,8 +1,9 @@
|
||||
# $OpenBSD: Makefile,v 1.25 2010/11/26 15:00:45 espie Exp $
|
||||
# $OpenBSD: Makefile,v 1.26 2011/01/31 14:59:38 naddy Exp $
|
||||
|
||||
COMMENT= BitTorrent library written in C++
|
||||
|
||||
DISTNAME= libtorrent-0.12.6
|
||||
REVISION= 0
|
||||
SHARED_LIBS += torrent 17.0 # .11.6
|
||||
CATEGORIES= net devel
|
||||
|
||||
|
@ -1,6 +1,14 @@
|
||||
$OpenBSD: patch-src_torrent_poll_kqueue_cc,v 1.1 2008/11/25 16:21:28 naddy Exp $
|
||||
--- src/torrent/poll_kqueue.cc.orig Tue Oct 28 04:48:48 2008
|
||||
+++ src/torrent/poll_kqueue.cc Sun Nov 23 21:17:59 2008
|
||||
$OpenBSD: patch-src_torrent_poll_kqueue_cc,v 1.2 2011/01/31 14:59:38 naddy Exp $
|
||||
|
||||
The number of events is used to index an array of maxOpenSockets
|
||||
(file descriptors) elements. If there are fewer fds than maxEvents,
|
||||
this will cause a segfault.
|
||||
|
||||
Limit the number of events to the number of fds with an upper limit of
|
||||
maxEvents.
|
||||
|
||||
--- src/torrent/poll_kqueue.cc.orig Thu Nov 12 09:03:58 2009
|
||||
+++ src/torrent/poll_kqueue.cc Sat Jan 29 01:04:59 2011
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "config.h"
|
||||
|
||||
@ -9,3 +17,12 @@ $OpenBSD: patch-src_torrent_poll_kqueue_cc,v 1.1 2008/11/25 16:21:28 naddy Exp $
|
||||
|
||||
#include <algorithm>
|
||||
#include <unistd.h>
|
||||
@@ -115,7 +116,7 @@ PollKQueue::create(int maxOpenSockets) {
|
||||
|
||||
PollKQueue::PollKQueue(int fd, int maxEvents, int maxOpenSockets) :
|
||||
m_fd(fd),
|
||||
- m_maxEvents(maxEvents),
|
||||
+ m_maxEvents((maxOpenSockets < maxEvents) ? maxOpenSockets : maxEvents),
|
||||
m_waitingEvents(0),
|
||||
m_changedEvents(0),
|
||||
m_stdinEvent(NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user