[Lldb-commits] [lldb] 4f6d3a3 - [LLDB] Fix setting of success in Socket::Close()

Shafik Yaghmour via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 7 12:43:04 PST 2022


Author: Shafik Yaghmour
Date: 2022-01-07T12:42:58-08:00
New Revision: 4f6d3a376c9faba93bbdf105966cea7585b0b8e9

URL: https://github.com/llvm/llvm-project/commit/4f6d3a376c9faba93bbdf105966cea7585b0b8e9
DIFF: https://github.com/llvm/llvm-project/commit/4f6d3a376c9faba93bbdf105966cea7585b0b8e9.diff

LOG: [LLDB] Fix setting of success in Socket::Close()

Both close and closesocket should return 0 on success so using !! looks incorrect. I replaced this will a more readable == 0 check.

Differential Revision: https://reviews.llvm.org/D116768

Added: 
    

Modified: 
    lldb/source/Host/common/Socket.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Host/common/Socket.cpp b/lldb/source/Host/common/Socket.cpp
index cc06597975300..1c74a8fb59029 100644
--- a/lldb/source/Host/common/Socket.cpp
+++ b/lldb/source/Host/common/Socket.cpp
@@ -281,9 +281,9 @@ Status Socket::Close() {
             static_cast<void *>(this), static_cast<uint64_t>(m_socket));
 
 #if defined(_WIN32)
-  bool success = !!closesocket(m_socket);
+  bool success = closesocket(m_socket) == 0;
 #else
-  bool success = !!::close(m_socket);
+  bool success = ::close(m_socket) == 0;
 #endif
   // A reference to a FD was passed in, set it to an invalid value
   m_socket = kInvalidSocketValue;


        


More information about the lldb-commits mailing list