summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ACE/ace/INET_Addr.cpp3
-rw-r--r--ACE/tests/INET_Addr_Test.cpp9
2 files changed, 11 insertions, 1 deletions
diff --git a/ACE/ace/INET_Addr.cpp b/ACE/ace/INET_Addr.cpp
index 96e26b93dcf..f12f3f83ada 100644
--- a/ACE/ace/INET_Addr.cpp
+++ b/ACE/ace/INET_Addr.cpp
@@ -182,7 +182,8 @@ ACE_INET_Addr::ACE_INET_Addr (void)
ACE_INET_Addr &
ACE_INET_Addr::operator= (const ACE_INET_Addr& rhs)
{
- this->set (rhs);
+ if (this != &rhs)
+ this->set (rhs);
return *this;
}
diff --git a/ACE/tests/INET_Addr_Test.cpp b/ACE/tests/INET_Addr_Test.cpp
index 9e2cfc7a4a9..f216789a5bc 100644
--- a/ACE/tests/INET_Addr_Test.cpp
+++ b/ACE/tests/INET_Addr_Test.cpp
@@ -322,6 +322,15 @@ int run_main (int, ACE_TCHAR *[])
if (!test_multiple ())
status = 1;
+ ACE_INET_Addr a1 (80, "127.0.0.1");
+ ACE_INET_Addr a2 = a1;
+ if (a1 != a2)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Address equality check failed after assignment\n")));
+ status = 1;
+ }
+
ACE_END_TEST;
return status;