diff options
author | Alfranio Correia <alfranio.correia@sun.com> | 2010-01-13 12:22:34 +0000 |
---|---|---|
committer | Alfranio Correia <alfranio.correia@sun.com> | 2010-01-13 12:22:34 +0000 |
commit | 46d1689b7c90c18a17dfcd71ef77c510c3ff122c (patch) | |
tree | dddf2d3ec6941e3f9c47deefb52bcfa19ef6a23e /client | |
parent | 231773b44919435b33696f77023ba81fd8a274c4 (diff) | |
parent | 357496c091991d5f22f2b06429757415841fb76b (diff) | |
download | mariadb-git-46d1689b7c90c18a17dfcd71ef77c510c3ff122c.tar.gz |
merge mysql-next-mr --> mysql-5.1-rpl-merge
Conflicts:
Text conflict in sql/log.cc
Text conflict in sql/slave.cc
Text conflict in sql/sql_base.cc
Diffstat (limited to 'client')
-rw-r--r-- | client/client_priv.h | 2 | ||||
-rw-r--r-- | client/mysqltest.cc | 28 |
2 files changed, 17 insertions, 13 deletions
diff --git a/client/client_priv.h b/client/client_priv.h index 97a8920f744..9cd151f6160 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -101,7 +101,7 @@ enum options_client /** First mysql version supporting the performance schema. */ -#define FIRST_PERFORMANCE_SCHEMA_VERSION 50600 +#define FIRST_PERFORMANCE_SCHEMA_VERSION 50599 /** Name of the performance schema database. diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 43107d838ee..95255b59afa 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -72,6 +72,10 @@ #define QUERY_SEND_FLAG 1 #define QUERY_REAP_FLAG 2 +#ifndef HAVE_SETENV +#error implement our portable setenv replacement in mysys +#endif + enum { OPT_SKIP_SAFEMALLOC=OPT_MAX_CLIENT_OPTION, OPT_PS_PROTOCOL, OPT_SP_PROTOCOL, OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL, @@ -216,7 +220,6 @@ typedef struct int alloced_len; int int_dirty; /* do not update string if int is updated until first read */ int alloced; - char *env_s; } VAR; /*Perl/shell-like variable registers */ @@ -1924,13 +1927,20 @@ VAR *var_init(VAR *v, const char *name, int name_len, const char *val, + name_len+1, MYF(MY_WME)))) die("Out of memory"); - tmp_var->name = (name) ? (char*) tmp_var + sizeof(*tmp_var) : 0; + if (name != NULL) + { + tmp_var->name= reinterpret_cast<char*>(tmp_var) + sizeof(*tmp_var); + memcpy(tmp_var->name, name, name_len); + tmp_var->name[name_len]= 0; + } + else + tmp_var->name= NULL; + tmp_var->alloced = (v == 0); if (!(tmp_var->str_val = (char*)my_malloc(val_alloc_len+1, MYF(MY_WME)))) die("Out of memory"); - memcpy(tmp_var->name, name, name_len); if (val) { memcpy(tmp_var->str_val, val, val_len); @@ -1941,7 +1951,6 @@ VAR *var_init(VAR *v, const char *name, int name_len, const char *val, tmp_var->alloced_len = val_alloc_len; tmp_var->int_val = (val) ? atoi(val) : 0; tmp_var->int_dirty = 0; - tmp_var->env_s = 0; return tmp_var; } @@ -2069,20 +2078,15 @@ void var_set(const char *var_name, const char *var_name_end, if (env_var) { - char buf[1024], *old_env_s= v->env_s; if (v->int_dirty) { sprintf(v->str_val, "%d", v->int_val); v->int_dirty= 0; v->str_val_len= strlen(v->str_val); } - my_snprintf(buf, sizeof(buf), "%.*s=%.*s", - v->name_len, v->name, - v->str_val_len, v->str_val); - if (!(v->env_s= my_strdup(buf, MYF(MY_WME)))) - die("Out of memory"); - putenv(v->env_s); - my_free(old_env_s, MYF(MY_ALLOW_ZERO_PTR)); + /* setenv() expects \0-terminated strings */ + DBUG_ASSERT(v->name[v->name_len] == 0); + setenv(v->name, v->str_val, 1); } DBUG_VOID_RETURN; } |