Commit 2c3f6568 authored by unknown's avatar unknown

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.


sql/item_strfunc.cc:
  Don't segfault in USER() if thd->user == 0 (system thread).
parent 0f85fb67
......@@ -1094,7 +1094,8 @@ String *Item_func_database::val_str(String *str)
String *Item_func_user::val_str(String *str)
{
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(thd->host ? thd->host : thd->ip ? thd->ip : ""))
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