You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2014/01/03 18:18:58 UTC

[27/50] git commit: TS-32: temp fix the overrun problem in PollDescriptor::alloc()

TS-32: temp fix the overrun problem in PollDescriptor::alloc()

may need better solution on pollfd.

Signed-off-by: Zhao Yongming <mi...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/1d01716c
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/1d01716c
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/1d01716c

Branch: refs/heads/5.0.x
Commit: 1d01716ceb2febf4fdcde2f2aae38f55e369d414
Parents: cf054cb
Author: Gota Adachi <ad...@iij.ad.jp>
Authored: Tue Dec 24 15:16:12 2013 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Sun Dec 29 18:45:20 2013 +0800

----------------------------------------------------------------------
 iocore/net/P_UnixPollDescriptor.h | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1d01716c/iocore/net/P_UnixPollDescriptor.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UnixPollDescriptor.h b/iocore/net/P_UnixPollDescriptor.h
index f694670..af3d9e7 100644
--- a/iocore/net/P_UnixPollDescriptor.h
+++ b/iocore/net/P_UnixPollDescriptor.h
@@ -106,6 +106,10 @@ struct PollDescriptor
   Pollfd *alloc()
   {
 #if TS_USE_EPOLL
+    // XXX : We need restrict max size based on definition.
+    if (nfds >= POLL_DESCRIPTOR_SIZE) {
+      nfds = 0;
+    }
     return &pfd[nfds++];
 #else
     return 0;