osaf/libs/core/cplusplus/base/unix_server_socket.cc |  1 +
 osaf/libs/core/cplusplus/base/unix_socket.cc        |  4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)


The virtual method UnixServerSocket::CloseHook() was not called from the
UnixSocket destructor (since it is a virtual method in a subclass). Instead,
unlink the socket file in the UnixServerSocket destructor.

diff --git a/osaf/libs/core/cplusplus/base/unix_server_socket.cc 
b/osaf/libs/core/cplusplus/base/unix_server_socket.cc
--- a/osaf/libs/core/cplusplus/base/unix_server_socket.cc
+++ b/osaf/libs/core/cplusplus/base/unix_server_socket.cc
@@ -27,6 +27,7 @@ UnixServerSocket::UnixServerSocket(const
 }
 
 UnixServerSocket::~UnixServerSocket() {
+  if (fd() >= 0) UnixServerSocket::CloseHook();
 }
 
 bool UnixServerSocket::OpenHook(int sock) {
diff --git a/osaf/libs/core/cplusplus/base/unix_socket.cc 
b/osaf/libs/core/cplusplus/base/unix_socket.cc
--- a/osaf/libs/core/cplusplus/base/unix_socket.cc
+++ b/osaf/libs/core/cplusplus/base/unix_socket.cc
@@ -55,7 +55,9 @@ int UnixSocket::Open() {
 }
 
 UnixSocket::~UnixSocket() {
-  Close();
+  if (fd_ >= 0) close(fd_);
+  fd_ = -1;
+  addr_.sun_path[0] = '\0';
 }
 
 void UnixSocket::Close() {

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to