Fix bug358; return EINVAL for inappropriate listen() call
authorTom Henderson <tomh@tomh.org>
Mon Dec 01 21:45:32 2008 -0800 (14 months ago)
changeset 3966b2f4788d3db7
parent 3965 1210035e1828
child 3967 f33cbf6b051c
Fix bug358; return EINVAL for inappropriate listen() call
src/internet-stack/tcp-socket-impl.cc
     1.1 --- a/src/internet-stack/tcp-socket-impl.cc	Mon Dec 01 21:35:24 2008 -0800
     1.2 +++ b/src/internet-stack/tcp-socket-impl.cc	Mon Dec 01 21:45:32 2008 -0800
     1.3 @@ -456,6 +456,12 @@
     1.4  TcpSocketImpl::Listen (void)
     1.5  {
     1.6    NS_LOG_FUNCTION (this);
     1.7 +  // Linux quits EINVAL if we're not closed, so match what they do
     1.8 +  if (m_state != CLOSED)
     1.9 +    {
    1.10 +      m_errno = ERROR_INVAL;
    1.11 +      return -1;
    1.12 +    }
    1.13    Actions_t action = ProcessEvent (APP_LISTEN);
    1.14    ProcessAction (action);
    1.15    return 0;