summaryrefslogtreecommitdiff
path: root/libmysqld
diff options
context:
space:
mode:
authorunknown <hf@deer.(none)>2003-09-08 13:02:19 +0500
committerunknown <hf@deer.(none)>2003-09-08 13:02:19 +0500
commit2a5b413ab13bcbd5a9fbef914657c7fac2d27246 (patch)
tree71996b4c2cc36d8482183dd6c6fe68c83f736603 /libmysqld
parent07cacdcbe73670f9d2fde0adf68f5e2472d7c6bd (diff)
downloadmariadb-git-2a5b413ab13bcbd5a9fbef914657c7fac2d27246.tar.gz
Fix for #1210
i fixed this in 4.1 in slightly different way libmysqld/lib_sql.cc: Initialization's flag was made global libmysqld/libmysqld.c: Check for mysql_server_init call added
Diffstat (limited to 'libmysqld')
-rw-r--r--libmysqld/lib_sql.cc7
-rw-r--r--libmysqld/libmysqld.c13
2 files changed, 17 insertions, 3 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index eddb326f6c4..52ff08b8787 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -306,7 +306,8 @@ char **copy_arguments(int argc, char **argv)
extern "C"
{
-static my_bool inited, org_my_init_done;
+static my_bool org_my_init_done;
+my_bool server_inited;
ulong max_allowed_packet, net_buffer_length;
char ** copy_arguments_ptr= 0;
@@ -338,9 +339,9 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups)
my_umask_dir=0700; // Default umask for new directories
/* Only call MY_INIT() if it hasn't been called before */
- if (!inited)
+ if (!server_inited)
{
- inited=1;
+ server_inited=1;
org_my_init_done=my_init_done;
}
if (!org_my_init_done)
diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c
index 782731d4765..20dde620131 100644
--- a/libmysqld/libmysqld.c
+++ b/libmysqld/libmysqld.c
@@ -74,6 +74,8 @@ static int send_file_to_server(MYSQL *mysql,const char *filename);
static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
const char *from, ulong length);
+extern char server_inited;
+
#define init_sigpipe_variables
#define set_sigpipe(mysql)
#define reset_sigpipe(mysql)
@@ -802,6 +804,17 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
db ? db : "(Null)",
user ? user : "(Null)"));
+ /*
+ Check mysql_server_init was called.
+ This code shouldn't be merged to 4.1
+ */
+ if (!server_inited)
+ {
+ net->last_errno=CR_UNKNOWN_ERROR;
+ strmov(net->last_error,ER(net->last_errno));
+ goto error;
+ }
+
net->vio = 0; /* If something goes wrong */
/* use default options */
if (mysql->options.my_cnf_file || mysql->options.my_cnf_group)