[libc-commits] [libc] 596d87c - [libc] Another fix to add a null-terminator to the pthread name.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Thu Apr 20 20:34:42 PDT 2023


Author: Siva Chandra Reddy
Date: 2023-04-21T03:34:34Z
New Revision: 596d87c4cce17f4842e852a0a4f57bcc7e8ab02b

URL: https://github.com/llvm/llvm-project/commit/596d87c4cce17f4842e852a0a4f57bcc7e8ab02b
DIFF: https://github.com/llvm/llvm-project/commit/596d87c4cce17f4842e852a0a4f57bcc7e8ab02b.diff

LOG: [libc] Another fix to add a null-terminator to the pthread name.

This fix is similar to the one done in https://reviews.llvm.org/D148844.
This miss was caught by the risv64 builder.

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

Added: 
    

Modified: 
    libc/src/__support/threads/linux/thread.cpp

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/threads/linux/thread.cpp b/libc/src/__support/threads/linux/thread.cpp
index bc8e16ec91013..357d139a227e1 100644
--- a/libc/src/__support/threads/linux/thread.cpp
+++ b/libc/src/__support/threads/linux/thread.cpp
@@ -358,7 +358,7 @@ int Thread::get_name(cpp::StringStream &name) const {
     int retval = __llvm_libc::syscall_impl(SYS_prctl, PR_GET_NAME, name_buffer);
     if (retval < 0)
       return -retval;
-    name << name_buffer;
+    name << name_buffer << cpp::StringStream::ENDS;
     return 0;
   }
 


        


More information about the libc-commits mailing list