diff options
Diffstat (limited to 'ACE')
-rw-r--r-- | ACE/ChangeLog | 6 | ||||
-rw-r--r-- | ACE/tests/Network_Adapters_Test.cpp | 43 |
2 files changed, 39 insertions, 10 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog index 1944a0a2072..c631fb4eef8 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,9 @@ +Tue Oct 7 23:01:44 UTC 2008 Steve Huston <shuston@riverace.com> + + * tests/Network_Adapters_Test.cpp: If the ping/raw socket open fails + because of a lack of privilege, issue a warning that the test can't + run, not an error. + Mon Oct 6 22:27:54 UTC 2008 Steve Huston <shuston@riverace.com> * ace/WFMO_Reactor.inl (suspend_handlers): Never suspend the notify diff --git a/ACE/tests/Network_Adapters_Test.cpp b/ACE/tests/Network_Adapters_Test.cpp index e7e997e6731..a45b3c4ea28 100644 --- a/ACE/tests/Network_Adapters_Test.cpp +++ b/ACE/tests/Network_Adapters_Test.cpp @@ -290,11 +290,22 @@ Echo_Handler::open (ACE_Reactor * const reactor, this->max_attempts_num_ = max_attempts_num; this->current_attempt_ = this->max_attempts_num_; + // If this process doesn't have privileges to open a raw socket, log + // a warning instead of an error. if (this->ping_socket ().open (local_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("(%P|%t) Echo_Handler::open: %p\n"), - ACE_TEXT ("ping_socket_")), - -1); + { + if (errno == EPERM) + ACE_ERROR_RETURN ((LM_WARNING, + ACE_TEXT ("(%P|%t) Echo_Handler::open: ") + ACE_TEXT ("ping_socket_: insufficient privs to ") + ACE_TEXT ("run this test\n")), + -1); + else + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("(%P|%t) Echo_Handler::open: %p\n"), + ACE_TEXT ("ping_socket_")), + -1); + } // register with the reactor for input if (this->reactor ()->register_handler (this, @@ -1092,9 +1103,16 @@ run_main (int argc, ACE_TCHAR *argv[]) 2, // max_attempts_number local_adapter) == -1) { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) %p\n"), - ACE_TEXT ("main() - ping_handler->open"))); + // If this process doesn't have privileges to open a raw socket, log + // a warning instead of an error. + if (errno == EPERM) + ACE_ERROR ((LM_WARNING, + ACE_TEXT ("(%P|%t) main() - ping_handler->open: ") + ACE_TEXT ("insufficient privs to run this test\n"))); + else + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) %p\n"), + ACE_TEXT ("main() - ping_handler->open"))); ACE_OS::exit (-4); } } @@ -1110,9 +1128,14 @@ run_main (int argc, ACE_TCHAR *argv[]) ping_status, 2) == -1) // max_attempts_number { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) %p\n"), - ACE_TEXT ("main() - ping_handler->open ()"))); + if (errno == EPERM) + ACE_ERROR ((LM_WARNING, + ACE_TEXT ("(%P|%t) main() - ping_handler->open: ") + ACE_TEXT ("insufficient privs to run this test\n"))); + else + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) %p\n"), + ACE_TEXT ("main() - ping_handler->open"))); ACE_OS::exit (-4); } } |