Commit 119d3f03 authored by guilhem@mysql.com's avatar guilhem@mysql.com

Backporting the changeset below from 4.0, because a customer hits

the bug with 3.23.
ChangeSet@1.1416.113.1, 2003-03-22 15:22:59+01:00, guilhem@mysql.com
  Fix for #178  Replicating INSERT VALUES(USER()) crashes (SEGV) the slave
      Now it does not SEGV, but USER() is still badly replicated
      (it is replicated to ""), which is a lower priority bug.
parent c46f888f
...@@ -1094,7 +1094,8 @@ String *Item_func_database::val_str(String *str) ...@@ -1094,7 +1094,8 @@ String *Item_func_database::val_str(String *str)
String *Item_func_user::val_str(String *str) String *Item_func_user::val_str(String *str)
{ {
THD *thd=current_thd; THD *thd=current_thd;
if (str->copy((const char*) thd->user,(uint) strlen(thd->user)) || if (!(thd->user) || // for system threads (e.g. replication thread)
str->copy((const char*) thd->user,(uint) strlen(thd->user)) ||
str->append('@') || str->append('@') ||
str->append(thd->host ? thd->host : thd->ip ? thd->ip : "")) str->append(thd->host ? thd->host : thd->ip ? thd->ip : ""))
return &empty_string; return &empty_string;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment