From fc5445ac0349bcd58dd8d037c6a53e127b7ee69a Mon Sep 17 00:00:00 2001
From: unknown <marko@hundin.mysql.fi>
Date: Wed, 12 May 2004 16:44:53 +0300
Subject: [PATCH] InnoDB: avoid some data races in innobase_mysql_print_thd()
 (Bug #3596)

sql/ha_innodb.cc:
  innobase_mysql_print_thd(): initial fix to Bug #3596
---
 sql/ha_innodb.cc | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index ac7ccf5c11..8651125e33 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -323,9 +323,10 @@ innobase_mysql_print_thd(
 	FILE*   f,	/* in: output stream */
         void*   input_thd)/* in: pointer to a MySQL THD object */
 {
-  	THD*    thd;
+	const THD*	thd;
+	const char*	s;
 
-        thd = (THD*) input_thd;
+        thd = (const THD*) input_thd;
 
   	fprintf(f, "MySQL thread id %lu, query id %lu",
 		thd->thread_id, thd->query_id);
@@ -344,14 +345,14 @@ innobase_mysql_print_thd(
 		fputs(thd->user, f);
   	}
 
-	if (thd->proc_info) {
+	if ((s = thd->proc_info)) {
 		putc(' ', f);
-		fputs(thd->proc_info, f);
+		fputs(s, f);
 	}
 
-	if (thd->query) {
+	if ((s = thd->query)) {
 		putc(' ', f);
-		fputs(thd->query, f);
+		fputs(s, f);
 	}
 
 	putc('\n', f);
-- 
2.30.9