]> sourceware.org Git - glibc.git/commitdiff
Fix reading thread name from comm file
authorUlrich Drepper <drepper@gmail.com>
Thu, 22 Dec 2011 00:26:29 +0000 (19:26 -0500)
committerUlrich Drepper <drepper@gmail.com>
Thu, 22 Dec 2011 00:26:29 +0000 (19:26 -0500)
NEWS
nptl/ChangeLog
nptl/sysdeps/unix/sysv/linux/pthread_getname.c

diff --git a/NEWS b/NEWS
index e40ce3f809a0866116241cb95d20647c8594aa10..aba4a8db7520128c1e7b5b8cf0578d2d3d02f3ca 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -13,7 +13,7 @@ Version 2.15
   12885, 12892, 12907, 12922, 12935, 13007, 13021, 13067, 13068, 13090,
   13092, 13114, 13118, 13123, 13134, 13138, 13147, 13150, 13179, 13192,
   13268, 13276, 13291, 13335, 13337, 13344, 13358, 13367, 13439, 13446,
-  13472, 13484, 13506, 13524
+  13472, 13484, 13506, 13515, 13524
 
 * New program pldd to list loaded object of a process
   Implemented by Ulrich Drepper.
index b622fe7c0f2b14de9700f37de539ffc8412b24b4..31177bf17c7a12184548a0df23f93a485c344e36 100644 (file)
@@ -1,3 +1,9 @@
+2011-12-21  Ulrich Drepper  <drepper@gmail.com>
+
+       [BZ #13515]
+       * sysdeps/unix/sysv/linux/pthread_getname.c (pthread_getname_np):
+       Correct reading name from file.
+
 2011-12-14  Carlos O'Donell  <carlos@systemhalted.org>
 
        * allocatestack.c (allocate_stack): Return errno on failure.
index 6e7786f9874f9c370a43df8e66c2464decdc822a..2c5ee6305e92d80a1a4c7322146349fe5ebf3d4e 100644 (file)
@@ -1,5 +1,5 @@
 /* pthread_getname_np -- Get  thread name.  Linux version
-   Copyright (C) 2010 Free Software Foundation, Inc.
+   Copyright (C) 2010, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -57,6 +57,15 @@ pthread_getname_np (th, buf, len)
   ssize_t n = TEMP_FAILURE_RETRY (read_not_cancel (fd, buf, len));
   if (n < 0)
     res = errno;
+  else
+    {
+      if (buf[n - 1] == '\n')
+       buf[n - 1] = '\0';
+      else if (n == len)
+       res = ERANGE;
+      else
+       buf[n] = '\0';
+    }
 
   close_not_cancel_no_status (fd);
 
This page took 0.087216 seconds and 5 git commands to generate.