[libc-commits] [libc] 8972c0d - [libc] Add null-terminator to the thread name obtained from the syscall.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Thu Apr 20 14:35:19 PDT 2023


Author: Siva Chandra Reddy
Date: 2023-04-20T21:35:05Z
New Revision: 8972c0df42e02d707d862d44f97f357f4bf69d21

URL: https://github.com/llvm/llvm-project/commit/8972c0df42e02d707d862d44f97f357f4bf69d21
DIFF: https://github.com/llvm/llvm-project/commit/8972c0df42e02d707d862d44f97f357f4bf69d21.diff

LOG: [libc] Add null-terminator to the thread name obtained from the syscall.

This bug was caught by the aarch64 full build builder.

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

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 aba8cf0b42f7b..bc8e16ec91013 100644
--- a/libc/src/__support/threads/linux/thread.cpp
+++ b/libc/src/__support/threads/linux/thread.cpp
@@ -385,7 +385,7 @@ int Thread::get_name(cpp::StringStream &name) const {
     name_buffer[retval - 1] = '\0';
   else
     name_buffer[retval] = '\0';
-  name << name_buffer;
+  name << name_buffer << cpp::StringStream::ENDS;
   return 0;
 }
 


        


More information about the libc-commits mailing list