diff options
author | unknown <reggie@bob.(none)> | 2005-02-01 08:46:56 -0600 |
---|---|---|
committer | unknown <reggie@bob.(none)> | 2005-02-01 08:46:56 -0600 |
commit | 514b2364b4156e23fb15f4506a50877011b9c7ef (patch) | |
tree | cabe5666325b62eeca6210083b3ecc5d9016bf6f | |
parent | e1f418e14004a76e90624f5dace7714528d7f0aa (diff) | |
parent | 199375cbc94eda3d60b9c038037e19a7e9cdf8f4 (diff) | |
download | mariadb-git-514b2364b4156e23fb15f4506a50877011b9c7ef.tar.gz |
Merge rburnett@bk-internal.mysql.com:/home/bk/mysql-4.1
into bob.(none):/home/reggie/bk/mysql41
-rw-r--r-- | extra/perror.c | 13 | ||||
-rw-r--r-- | sql/sql_table.cc | 6 |
2 files changed, 14 insertions, 5 deletions
diff --git a/extra/perror.c b/extra/perror.c index 1bd4b203120..fc10d8eaecc 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -184,6 +184,7 @@ int main(int argc,char *argv[]) { int error,code,found; const char *msg; + char *unknown_error = 0; MY_INIT(argv[0]); if (get_options(&argc,&argv)) @@ -212,7 +213,12 @@ int main(int argc,char *argv[]) string 'Unknown Error'. To avoid printing it we try to find the error string by asking for an impossible big error message. */ - const char *unknown_error= strerror(10000); + msg = strerror(10000); + + /* allocate a buffer for unknown_error since strerror always returns the same pointer + on some platforms such as Windows */ + unknown_error = malloc( strlen(msg)+1 ); + strcpy( unknown_error, msg ); for ( ; argc-- > 0 ; argv++) { @@ -262,6 +268,11 @@ int main(int argc,char *argv[]) } } } + + /* if we allocated a buffer for unknown_error, free it now */ + if (unknown_error) + free(unknown_error); + exit(error); return error; } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 423a309767b..f3c107c2696 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2272,8 +2272,7 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table, strxmov(src_path, (*tmp_table)->path, reg_ext, NullS); else { - strxmov(src_path, mysql_data_home, "/", src_db, "/", src_table, - reg_ext, NullS); + fn_format( src_path, src_table, src_db, reg_ext, MYF(MY_UNPACK_FILENAME)); if (access(src_path, F_OK)) { my_error(ER_BAD_TABLE_ERROR, MYF(0), src_table); @@ -2300,8 +2299,7 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table, } else { - strxmov(dst_path, mysql_data_home, "/", db, "/", table_name, - reg_ext, NullS); + fn_format( dst_path, table_name, db, reg_ext, MYF(MY_UNPACK_FILENAME)); if (!access(dst_path, F_OK)) goto table_exists; } |