summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarko@hundin.mysql.fi <>2004-05-13 16:18:39 +0300
committermarko@hundin.mysql.fi <>2004-05-13 16:18:39 +0300
commit077f0812fc40427e0186067ac2faaa8d77b4b845 (patch)
tree7c8dd6e7000b618a4a5f8d13918e581064e6ddd0
parentbd8901fd735433838219c064bbfbc2e525e4cfd3 (diff)
downloadmariadb-git-077f0812fc40427e0186067ac2faaa8d77b4b845.tar.gz
ha_innodb.cc:
innobase_mysql_print_thd(): protect thd with LOCK_thread_count (Bug #3596)
-rw-r--r--sql/ha_innodb.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 8651125e331..d5bbeb874ad 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -328,6 +328,8 @@ innobase_mysql_print_thd(
thd = (const THD*) input_thd;
+ VOID(pthread_mutex_lock(&LOCK_thread_count));
+
fprintf(f, "MySQL thread id %lu, query id %lu",
thd->thread_id, thd->query_id);
if (thd->host) {
@@ -351,11 +353,16 @@ innobase_mysql_print_thd(
}
if ((s = thd->query)) {
- putc(' ', f);
- fputs(s, f);
+ /* determine the length of the query string */
+ uint32 i, len = thd->query_length;
+ for (i = 0; i < len && s[i]; i++);
+ putc('\n', f);
+ fwrite(s, 1, i, f);
}
putc('\n', f);
+
+ VOID(pthread_mutex_unlock(&LOCK_thread_count));
}
/*************************************************************************