Fix off-by-one error.
authorRichard Trieu <rtrieu@google.com>
Fri, 31 May 2019 05:06:54 +0000 (05:06 +0000)
committerRichard Trieu <rtrieu@google.com>
Fri, 31 May 2019 05:06:54 +0000 (05:06 +0000)
The created string is one char too large, so it pulls the terminating NULL as
the last character of the string.  This later causes SocketTest.cpp to fail.

llvm-svn: 362192

lldb/source/Host/posix/DomainSocket.cpp

index f4b5f428742bb6aa6f93b6da6c99478eb1a66566..2710213efde2ff3c8f94fe3d4f97d224ead30c20 100644 (file)
@@ -136,7 +136,7 @@ std::string DomainSocket::GetSocketName() const {
       return std::string(saddr_un.sun_path + GetNameOffset(),
                          sock_addr_len -
                              offsetof(struct sockaddr_un, sun_path) -
-                             GetNameOffset());
+                             GetNameOffset() - 1);
   }
   return "";
 }