diff options
author | unknown <guilhem@mysql.com> | 2003-08-01 22:29:38 +0200 |
---|---|---|
committer | unknown <guilhem@mysql.com> | 2003-08-01 22:29:38 +0200 |
commit | 2c3f6568797ecc269371b7d20eecdf4993905cec (patch) | |
tree | 84384e40b1850b920e9b1ec994d9ff2dcc65949c /sql | |
parent | 0f85fb676c1ecf7b148af3ca92402099eb179e62 (diff) | |
download | mariadb-git-2c3f6568797ecc269371b7d20eecdf4993905cec.tar.gz |
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).
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_strfunc.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 323810398ec..9e37a5a18e5 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -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; |