Author: Michał Górny
Date: 2022-02-10T15:46:04-08:00
New Revision: 1772de7212e9d2ea0711028709a5833ea7769173

URL: 
https://github.com/llvm/llvm-project/commit/1772de7212e9d2ea0711028709a5833ea7769173
DIFF: 
https://github.com/llvm/llvm-project/commit/1772de7212e9d2ea0711028709a5833ea7769173.diff

LOG: [compiler-rt] Fix endianness in get_sock_peer_name test

Fix passing the port and IP address with the wrong endianness
in get_sock_peer_name() that causes the connect() to fail inside
without an outgoing network interface (it's trying to connect
to 1.0.0.127 instead of 127.0.0.1).

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

(cherry picked from commit c65fb0cdf26296ae83d23260337d1231d0249020)

Added: 
    

Modified: 
    compiler-rt/test/sanitizer_common/TestCases/Linux/get_sock_peer_name.cpp

Removed: 
    


################################################################################
diff  --git 
a/compiler-rt/test/sanitizer_common/TestCases/Linux/get_sock_peer_name.cpp 
b/compiler-rt/test/sanitizer_common/TestCases/Linux/get_sock_peer_name.cpp
index d4e6189d61703..04ac7a1072459 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Linux/get_sock_peer_name.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/get_sock_peer_name.cpp
@@ -17,10 +17,10 @@ int main() {
 
   const sockaddr_in sin = {
       .sin_family = AF_INET,
-      .sin_port = 1234,
+      .sin_port = htons(1234),
       .sin_addr =
           {
-              .s_addr = INADDR_LOOPBACK,
+              .s_addr = htonl(INADDR_LOOPBACK),
           },
   };
   assert(connect(fd, reinterpret_cast<const sockaddr *>(&sin), sizeof(sin)) ==


        
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to