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
This commit is contained in:
jmallett 2002-10-20 22:49:06 +00:00
parent 7501f71bca
commit c377d3e2b4

View File

@ -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: */