summaryrefslogtreecommitdiffstats
path: root/lib/libc_r/uthread
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2002-10-20 22:49:06 +0000
committerjmallett <jmallett@FreeBSD.org>2002-10-20 22:49:06 +0000
commitc377d3e2b439a770210d502e3fd212a05929a7a2 (patch)
tree056cdf88fc176b21c48989320c5b2c5a02ba1fc0 /lib/libc_r/uthread
parent7501f71bca7e717e191458750665597044a67435 (diff)
downloadFreeBSD-src-c377d3e2b439a770210d502e3fd212a05929a7a2.zip
FreeBSD-src-c377d3e2b439a770210d502e3fd212a05929a7a2.tar.gz
When dumping thread info, only include the filename and line if we actually
know what file! (Prevents use of NULL). MFC after: 1 day Reviewed by: deischen
Diffstat (limited to 'lib/libc_r/uthread')
-rw-r--r--lib/libc_r/uthread/uthread_info.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/libc_r/uthread/uthread_info.c b/lib/libc_r/uthread/uthread_info.c
index c8bc4d5..c3d259e 100644
--- a/lib/libc_r/uthread/uthread_info.c
+++ b/lib/libc_r/uthread/uthread_info.c
@@ -220,11 +220,17 @@ dump_thread(int fd, pthread_t pthread, int long_version)
/* Output a record for the thread: */
snprintf(s, sizeof(s),
- "--------------------\nThread %p (%s) prio %3d state %s [%s:%d]\n",
+ "--------------------\nThread %p (%s) prio %3d state %s",
pthread, (pthread->name == NULL) ? "" : pthread->name,
- pthread->active_priority, thread_info[i].name, pthread->fname,
- pthread->lineno);
+ pthread->active_priority, thread_info[i].name);
__sys_write(fd, s, strlen(s));
+ /* And now where it is. */
+ if (pthread->fname != NULL) {
+ snprintf(s, sizeof(s), " [%s:%d]", pthread->fname,
+ pthread->lineno);
+ __sys_write(fd, s, strlen(s));
+ }
+ __sys_write(fd, "\n", 1);
if (long_version != 0) {
/* Check if this is the running thread: */
OpenPOWER on IntegriCloud